This commit is contained in:
WangWeimin 2021-06-29 03:57:09 -04:00 committed by GitHub
commit 0b1dbcb8d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -145,8 +145,15 @@ func (tx *Transaction) Verify(prevTXs map[string]Transaction) bool {
for inID, vin := range tx.Vin {
prevTx := prevTXs[hex.EncodeToString(vin.Txid)]
refVoutPubKeyHash := prevTx.Vout[vin.Vout].PubKeyHash
// check that the spend coin is owned by vin.PubKey
if !bytes.Equal(HashPubKey(vin.PubKey), refVoutPubKeyHash) {
return false
}
txCopy.Vin[inID].Signature = nil
txCopy.Vin[inID].PubKey = prevTx.Vout[vin.Vout].PubKeyHash
txCopy.Vin[inID].PubKey = refVoutPubKeyHash
r := big.Int{}
s := big.Int{}