Replaced privkey in entire codebase.
This commit is contained in:
parent
da080e1598
commit
516db23576
2 changed files with 30 additions and 30 deletions
|
@ -1137,8 +1137,8 @@ func signTxOutputCustomReader(reader io.Reader, tx *btcwire.MsgTx, idx int,
|
||||||
return append((&btcec.Signature{R: r, S: s}).Serialize(), hashType), nil
|
return append((&btcec.Signature{R: r, S: s}).Serialize(), hashType), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func p2pkSignatureScript(tx *btcwire.MsgTx, idx int, subScript []byte, hashType byte, privkey *ecdsa.PrivateKey) ([]byte, error) {
|
func p2pkSignatureScript(tx *btcwire.MsgTx, idx int, subScript []byte, hashType byte, privKey *ecdsa.PrivateKey) ([]byte, error) {
|
||||||
sig, err := signTxOutput(tx, idx, subScript, hashType, privkey)
|
sig, err := signTxOutput(tx, idx, subScript, hashType, privKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -2537,7 +2537,7 @@ var coinbaseOutPoint = &btcwire.OutPoint{
|
||||||
// Pregenerated private key, with associated public key and pkScripts
|
// Pregenerated private key, with associated public key and pkScripts
|
||||||
// for the uncompressed and compressed hash160.
|
// for the uncompressed and compressed hash160.
|
||||||
var (
|
var (
|
||||||
privkeyD = []byte{0x6b, 0x0f, 0xd8, 0xda, 0x54, 0x22, 0xd0, 0xb7,
|
privKeyD = []byte{0x6b, 0x0f, 0xd8, 0xda, 0x54, 0x22, 0xd0, 0xb7,
|
||||||
0xb4, 0xfc, 0x4e, 0x55, 0xd4, 0x88, 0x42, 0xb3, 0xa1, 0x65,
|
0xb4, 0xfc, 0x4e, 0x55, 0xd4, 0x88, 0x42, 0xb3, 0xa1, 0x65,
|
||||||
0xac, 0x70, 0x7f, 0x3d, 0xa4, 0x39, 0x5e, 0xcb, 0x3b, 0xb0,
|
0xac, 0x70, 0x7f, 0x3d, 0xa4, 0x39, 0x5e, 0xcb, 0x3b, 0xb0,
|
||||||
0xd6, 0x0e, 0x06, 0x92}
|
0xd6, 0x0e, 0x06, 0x92}
|
||||||
|
@ -2766,7 +2766,7 @@ var SigScriptTests = []TstSigScript{
|
||||||
// created for the MsgTxs in txTests, since they come from the blockchain
|
// created for the MsgTxs in txTests, since they come from the blockchain
|
||||||
// and we don't have the private keys.
|
// and we don't have the private keys.
|
||||||
func TestSignatureScript(t *testing.T) {
|
func TestSignatureScript(t *testing.T) {
|
||||||
privkey := &ecdsa.PrivateKey{
|
privKey := &ecdsa.PrivateKey{
|
||||||
PublicKey: ecdsa.PublicKey{
|
PublicKey: ecdsa.PublicKey{
|
||||||
Curve: btcec.S256(),
|
Curve: btcec.S256(),
|
||||||
X: new(big.Int),
|
X: new(big.Int),
|
||||||
|
@ -2774,9 +2774,9 @@ func TestSignatureScript(t *testing.T) {
|
||||||
},
|
},
|
||||||
D: new(big.Int),
|
D: new(big.Int),
|
||||||
}
|
}
|
||||||
privkey.D.SetBytes(privkeyD)
|
privKey.D.SetBytes(privKeyD)
|
||||||
privkey.PublicKey.X.SetBytes(pubkeyX)
|
privKey.PublicKey.X.SetBytes(pubkeyX)
|
||||||
privkey.PublicKey.Y.SetBytes(pubkeyY)
|
privKey.PublicKey.Y.SetBytes(pubkeyY)
|
||||||
|
|
||||||
nexttest:
|
nexttest:
|
||||||
for i := range SigScriptTests {
|
for i := range SigScriptTests {
|
||||||
|
@ -2802,7 +2802,7 @@ nexttest:
|
||||||
}
|
}
|
||||||
script, err = btcscript.SignatureScript(tx, idx,
|
script, err = btcscript.SignatureScript(tx, idx,
|
||||||
SigScriptTests[i].inputs[j].txout.PkScript,
|
SigScriptTests[i].inputs[j].txout.PkScript,
|
||||||
SigScriptTests[i].hashtype, privkey,
|
SigScriptTests[i].hashtype, privKey,
|
||||||
SigScriptTests[i].compress)
|
SigScriptTests[i].compress)
|
||||||
|
|
||||||
if (err == nil) != SigScriptTests[i].inputs[j].sigscriptGenerates {
|
if (err == nil) != SigScriptTests[i].inputs[j].sigscriptGenerates {
|
||||||
|
@ -3369,7 +3369,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3407,7 +3407,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3469,7 +3469,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3508,7 +3508,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3570,7 +3570,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3609,7 +3609,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3671,7 +3671,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3710,7 +3710,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3772,7 +3772,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3830,7 +3830,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3913,7 +3913,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -3971,7 +3971,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4053,7 +4053,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4111,7 +4111,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4193,7 +4193,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4251,7 +4251,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key, err := ecdsa.GenerateKey(btcec.S256(),
|
key, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4333,7 +4333,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key1, err := ecdsa.GenerateKey(btcec.S256(),
|
key1, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4351,7 +4351,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key2, err := ecdsa.GenerateKey(btcec.S256(),
|
key2, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey 2 for %s: %v",
|
t.Errorf("failed to make privKey 2 for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4412,7 +4412,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key1, err := ecdsa.GenerateKey(btcec.S256(),
|
key1, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4430,7 +4430,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key2, err := ecdsa.GenerateKey(btcec.S256(),
|
key2, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey 2 for %s: %v",
|
t.Errorf("failed to make privKey 2 for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4521,7 +4521,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key1, err := ecdsa.GenerateKey(btcec.S256(),
|
key1, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey for %s: %v",
|
t.Errorf("failed to make privKey for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -4539,7 +4539,7 @@ func TestSignTxOutput(t *testing.T) {
|
||||||
key2, err := ecdsa.GenerateKey(btcec.S256(),
|
key2, err := ecdsa.GenerateKey(btcec.S256(),
|
||||||
rand.Reader)
|
rand.Reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("failed to make privkey 2 for %s: %v",
|
t.Errorf("failed to make privKey 2 for %s: %v",
|
||||||
msg, err)
|
msg, err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue