Skip to content

Commit

Permalink
feat(btc): txn api.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhangguiguang committed May 24, 2024
1 parent 7e65c3c commit 5a39dbe
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/btc/transaction_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,14 @@ func (t *Transaction) RemoveOuput(index int) {
t.msgTx.TxOut = append(t.msgTx.TxOut[:index], t.msgTx.TxOut[index+1:]...)
}

// Nothing will happen if the index is invalid.
func (t *Transaction) SetOutputValue(value int64, index int) {
if index < 0 || index >= len(t.msgTx.TxOut) {
return
}
t.msgTx.TxOut[index].Value = value
}

func outPoint(txId string, index uint32) (*wire.OutPoint, error) {
txId = strings.TrimPrefix(txId, "0x")
txHash, err := chainhash.NewHashFromStr(txId)
Expand Down

0 comments on commit 5a39dbe

Please sign in to comment.