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

Method sign

protocol/tx_test.go:50–56  ·  view source on GitHub ↗
(t testing.TB, tx *legacy.Tx, index uint32)

Source from the content-addressed store, hash-verified

48}
49
50func (d *testDest) sign(t testing.TB, tx *legacy.Tx, index uint32) {
51 txsighash := tx.SigHash(index)
52 prog, _ := vm.Assemble(fmt.Sprintf("0x%x TXSIGHASH EQUAL", txsighash.Bytes()))
53 h := sha3.Sum256(prog)
54 sig := ed25519.Sign(d.privKey, h[:])
55 tx.Inputs[index].SetArguments([][]byte{vm.Int64Bytes(0), sig, prog})
56}
57
58func (d testDest) controlProgram() ([]byte, error) {
59 pub := d.privKey.Public().(ed25519.PublicKey)

Callers 1

issueFunction · 0.45

Calls 4

SigHashMethod · 0.80
SetArgumentsMethod · 0.80
SignMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected