shachain: Add two missing test cases from the BOLT spec.

This commit is contained in:
Jim Posen 2017-09-25 13:21:53 -07:00 committed by Olaoluwa Osuntokun
parent 490e0d0f46
commit ee86901acb
2 changed files with 18 additions and 0 deletions

@ -187,6 +187,8 @@ func TestDeriveIndex(t *testing.T) {
} }
} }
// deriveElementTests encodes the test vectors specified in BOLT-03,
// Appendix D, Generation Tests.
var deriveElementTests = []struct { var deriveElementTests = []struct {
name string name string
index index index index
@ -194,6 +196,20 @@ var deriveElementTests = []struct {
seed string seed string
shouldFail bool shouldFail bool
}{ }{
{
name: "generate_from_seed 0 final node",
seed: "0000000000000000000000000000000000000000000000000000000000000000",
index: 0xffffffffffff,
output: "02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148",
shouldFail: false,
},
{
name: "generate_from_seed FF final node",
seed: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
index: 0xffffffffffff,
output: "7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc",
shouldFail: false,
},
{ {
name: "generate_from_seed FF alternate bits 1", name: "generate_from_seed FF alternate bits 1",
index: 0xaaaaaaaaaaa, index: 0xaaaaaaaaaaa,

@ -13,6 +13,8 @@ type testInsert struct {
successful bool successful bool
} }
// tests encodes the test vectors specified in BOLT-03, Appendix D,
// Storage Tests.
var tests = []struct { var tests = []struct {
name string name string
inserts []testInsert inserts []testInsert