File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ const cbor = require('borc')
66
77module . exports = class TreeDAG extends DAG {
88 async put ( val ) {
9+ if ( TreeDAG . isValidLink ( val ) ) {
10+ return val
11+ }
912 const encoded = cbor . encode ( val )
1013 const key = await TreeDAG . getMerkleLink ( encoded )
1114
Original file line number Diff line number Diff line change @@ -4,6 +4,17 @@ const level = require('level-browserify')
44const RadixTree = require ( '../' )
55const db = level ( './testdb' )
66
7+ tape . only ( 'set and get' , async t => {
8+ let tree = new RadixTree ( {
9+ db : db
10+ } )
11+ const stateRoot = await tree . flush ( )
12+ console . log ( stateRoot )
13+ const stateRoot2 = await tree . flush ( )
14+ console . log ( stateRoot2 )
15+ t . end ( )
16+ } )
17+
718tape ( 'set and get' , async t => {
819 const r = await RadixTree . getMerkleLink ( Buffer . from ( [ 0 ] ) )
920
You can’t perform that action at this time.
0 commit comments