7 "github.com/davecgh/go-spew/spew"
9 chainjson "github.com/vapor/encoding/json"
10 "github.com/vapor/testutil"
13 func TestWitnessJSON(t *testing.T) {
14 si := &SigningInstruction{
16 WitnessComponents: []witnessComponent{
21 XPub: testutil.TestXPub,
22 DerivationPath: []chainjson.HexBytes{{5, 6, 7}},
24 Sigs: []chainjson.HexBytes{{8, 9, 10}},
29 XPub: testutil.TestXPub,
30 DerivationPath: []chainjson.HexBytes{{21, 22}},
32 Sigs: []chainjson.HexBytes{{23, 24, 25}},
37 b, err := json.MarshalIndent(si, "", " ")
42 var got SigningInstruction
43 err = json.Unmarshal(b, &got)
45 t.Fatalf("error on input %s: %s", b, err)
48 if !testutil.DeepEqual(si, &got) {
49 t.Errorf("got:\n%s\nwant:\n%s\nJSON was: %s", spew.Sdump(&got), spew.Sdump(si), string(b))