mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
contracts/ens: adjust swarm multicodecs after pr merge
This commit is contained in:
parent
4a601337c0
commit
408bfd8c19
2 changed files with 10 additions and 10 deletions
|
|
@ -30,8 +30,8 @@ const (
|
|||
ns_ipfs = 0xe3
|
||||
ns_swarm = 0xe4
|
||||
|
||||
swarm_typecode = 0x99 //todo change
|
||||
swarm_hashtype = 0x1b //todo change
|
||||
swarm_typecode = 0xfa //swarm manifest
|
||||
swarm_hashtype = 0xd6 // BMT
|
||||
|
||||
ipfs_hashtype = 0x12
|
||||
|
||||
|
|
@ -82,11 +82,11 @@ func extractContentHash(buf []byte) (common.Hash, error) {
|
|||
return common.Hash{}, errors.New("unknown storage system")
|
||||
}
|
||||
|
||||
if contentType != swarm_typecode { //todo pending pr
|
||||
if contentType != swarm_typecode {
|
||||
return common.Hash{}, errors.New("unknown content type")
|
||||
}
|
||||
|
||||
if hashType != swarm_hashtype { //todo: should be bmt
|
||||
if hashType != swarm_hashtype {
|
||||
return common.Hash{}, errors.New("unknown multihash type")
|
||||
}
|
||||
|
||||
|
|
@ -106,8 +106,8 @@ func encodeSwarmHash(hash common.Hash) ([]byte, error) {
|
|||
var headerBytes = []byte{
|
||||
ns_swarm, //swarm namespace
|
||||
cidv1, // CIDv1
|
||||
swarm_typecode, // the swarm type-code
|
||||
swarm_hashtype, // swarm hash type. todo BMT
|
||||
swarm_typecode, // swarm hash
|
||||
swarm_hashtype, // swarm bmt hash
|
||||
hash_length, //hash length. 32 bytes
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,22 +78,22 @@ func TestManualCidDecode(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
name: "values correct, should not fail",
|
||||
headerBytes: []byte{0xe4, 0x01, 0x99, 0x1b, 0x20},
|
||||
headerBytes: []byte{0xe4, 0x01, 0xfa, 0xd6, 0x20},
|
||||
fails: false,
|
||||
},
|
||||
{
|
||||
name: "cid version wrong, should fail",
|
||||
headerBytes: []byte{0xe4, 0x00, 0x99, 0x1b, 0x20},
|
||||
headerBytes: []byte{0xe4, 0x00, 0xfa, 0xd6, 0x20},
|
||||
fails: true,
|
||||
},
|
||||
{
|
||||
name: "hash length wrong, should fail",
|
||||
headerBytes: []byte{0xe4, 0x01, 0x99, 0x1b, 0x1f},
|
||||
headerBytes: []byte{0xe4, 0x01, 0xfa, 0xd6, 0x1f},
|
||||
fails: true,
|
||||
},
|
||||
{
|
||||
name: "values correct for ipfs, should fail",
|
||||
headerBytes: []byte{0xe3, 0x01, 0x99, 0x1b, 0x20},
|
||||
headerBytes: []byte{0xe3, 0x01, 0x70, 0x12, 0x20},
|
||||
fails: true,
|
||||
},
|
||||
} {
|
||||
|
|
|
|||
Loading…
Reference in a new issue