contracts/ens: revert bmt to keccak256

This commit is contained in:
Elad 2019-03-25 11:27:38 +09:00
parent 2f5b6cb442
commit b972dfa0ac
2 changed files with 5 additions and 5 deletions

View file

@ -31,7 +31,7 @@ const (
nsSwarm = 0xe4
swarmTypecode = 0xfa //swarm manifest, see https://github.com/multiformats/multicodec/blob/master/table.csv
swarmHashtype = 0xd6 // BMT, see https://github.com/multiformats/multicodec/blob/master/table.csv
swarmHashtype = 0x1b // BMT, see https://github.com/multiformats/multicodec/blob/master/table.csv
hashLength = 32
)
@ -106,7 +106,7 @@ func EncodeSwarmHash(hash common.Hash) ([]byte, error) {
nsSwarm, //swarm namespace
cidv1, // CIDv1
swarmTypecode, // swarm hash
swarmHashtype, // swarm bmt hash
swarmHashtype, // keccak256 hash
hashLength, //hash length. 32 bytes
}

View file

@ -76,17 +76,17 @@ func TestManualCidDecode(t *testing.T) {
}{
{
name: "values correct, should not fail",
headerBytes: []byte{0xe4, 0x01, 0xfa, 0xd6, 0x20},
headerBytes: []byte{0xe4, 0x01, 0xfa, 0x1b, 0x20},
wantErr: false,
},
{
name: "cid version wrong, should fail",
headerBytes: []byte{0xe4, 0x00, 0xfa, 0xd6, 0x20},
headerBytes: []byte{0xe4, 0x00, 0xfa, 0x1b, 0x20},
wantErr: true,
},
{
name: "hash length wrong, should fail",
headerBytes: []byte{0xe4, 0x01, 0xfa, 0xd6, 0x1f},
headerBytes: []byte{0xe4, 0x01, 0xfa, 0x1b, 0x1f},
wantErr: true,
},
{