calcHashInputAmts computes the hash digest of all the previous input scripts referenced by the passed transaction. This hash pre computation is only used for validating taproot inputs.
(tx *wire.MsgTx, inputFetcher PrevOutputFetcher)
| 168 | // referenced by the passed transaction. This hash pre computation is only used |
| 169 | // for validating taproot inputs. |
| 170 | func calcHashInputScripts(tx *wire.MsgTx, inputFetcher PrevOutputFetcher) chainhash.Hash { |
| 171 | var b bytes.Buffer |
| 172 | for _, txIn := range tx.TxIn { |
| 173 | prevOut := inputFetcher.FetchPrevOutput(txIn.PreviousOutPoint) |
| 174 | |
| 175 | _ = wire.WriteVarBytes(&b, 0, prevOut.PkScript) |
| 176 | } |
| 177 | |
| 178 | return chainhash.HashH(b.Bytes()) |
| 179 | } |
| 180 | |
| 181 | // SegwitSigHashMidstate is the sighash midstate used in the base segwit |
| 182 | // sighash calculation as defined in BIP 143. |
no test coverage detected
searching dependent graphs…