MCPcopy Create free account
hub / github.com/chain/Core / TestP2SP

Function TestP2SP

protocol/vmutil/script_test.go:74–91  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

72}
73
74func TestP2SP(t *testing.T) {
75 pub1, _, _ := ed25519.GenerateKey(nil)
76 pub2, _, _ := ed25519.GenerateKey(nil)
77 prog, _ := P2SPMultiSigProgram([]ed25519.PublicKey{pub1, pub2}, 1)
78 pubs, n, err := ParseP2SPMultiSigProgram(prog)
79 if err != nil {
80 t.Fatal(err)
81 }
82 if n != 1 {
83 t.Errorf("expected nrequired=1, got %d", n)
84 }
85 if !bytes.Equal(pubs[0], pub1) {
86 t.Errorf("expected first pubkey to be %x, got %x", pub1, pubs[0])
87 }
88 if !bytes.Equal(pubs[1], pub2) {
89 t.Errorf("expected second pubkey to be %x, got %x", pub2, pubs[1])
90 }
91}
92
93func TestBlockMultisig(t *testing.T) {
94 pub1, _, _ := ed25519.GenerateKey(nil)

Callers

nothing calls this directly

Calls 3

P2SPMultiSigProgramFunction · 0.85
ParseP2SPMultiSigProgramFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected