Skip to content

Commit 944bce0

Browse files
author
wanderer
committed
cleanup
1 parent f360b75 commit 944bce0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

datastore.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
const Buffer = require('safe-buffer').Buffer
22
const crypto = require('crypto')
33
const DAG = require('ipld-graph-builder/datastore.js')
4-
const HASH_LEN = 20
54
const cbor = require('borc')
65

6+
const HASH_LEN = 20
7+
const LINK_TAG = 42
8+
79
module.exports = class TreeDAG extends DAG {
810
async put (val) {
911
if (val[1]) {
10-
val[1] = new cbor.Tagged(42, val[1]['/'])
12+
val[1] = new cbor.Tagged(LINK_TAG, val[1]['/'])
1113
}
12-
1314
if (val[2]) {
14-
val[2] = new cbor.Tagged(42, val[2]['/'])
15+
val[2] = new cbor.Tagged(LINK_TAG, val[2]['/'])
1516
}
17+
1618
const encoded = cbor.encode(val)
1719
const key = await TreeDAG.getMerkleLink(encoded)
1820

@@ -34,7 +36,6 @@ module.exports = class TreeDAG extends DAG {
3436
if (decoded[1]) {
3537
decoded[1]['/'] = decoded[1].value
3638
}
37-
3839
if (decoded[2]) {
3940
decoded[2]['/'] = decoded[2].value
4041
}

0 commit comments

Comments
 (0)