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

Function TestBlockMultisig

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

Source from the content-addressed store, hash-verified

91}
92
93func TestBlockMultisig(t *testing.T) {
94 pub1, _, _ := ed25519.GenerateKey(nil)
95 pub2, _, _ := ed25519.GenerateKey(nil)
96 prog, _ := BlockMultiSigProgram([]ed25519.PublicKey{pub1, pub2}, 1)
97 pubs, n, err := ParseBlockMultiSigProgram(prog)
98 if err != nil {
99 t.Fatal(err)
100 }
101 if n != 1 {
102 t.Errorf("expected nrequired=1, got %d", n)
103 }
104 if !bytes.Equal(pubs[0], pub1) {
105 t.Errorf("expected first pubkey to be %x, got %x", pub1, pubs[0])
106 }
107 if !bytes.Equal(pubs[1], pub2) {
108 t.Errorf("expected second pubkey to be %x, got %x", pub2, pubs[1])
109 }
110}

Callers

nothing calls this directly

Calls 3

BlockMultiSigProgramFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected