Skip to content

Commit

Permalink
rename utxo field ScriptSig to ScriptPubKey
Browse files Browse the repository at this point in the history
  • Loading branch information
rohenaz committed Nov 18, 2020
1 parent 43163fd commit fd7813e
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 121 deletions.
8 changes: 4 additions & 4 deletions examples/create_tx/create_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ func main() {

// Use a new UTXO
utxo := &bitcoin.Utxo{
TxID: "b7b0650a7c3a1bd4716369783876348b59f5404784970192cec1996e86950576",
Vout: 0,
ScriptSig: "76a9149cbe9f5e72fa286ac8a38052d1d5337aa363ea7f88ac",
Satoshis: 1000,
TxID: "b7b0650a7c3a1bd4716369783876348b59f5404784970192cec1996e86950576",
Vout: 0,
ScriptPubKey: "76a9149cbe9f5e72fa286ac8a38052d1d5337aa363ea7f88ac",
Satoshis: 1000,
}

// Add a pay-to address
Expand Down
8 changes: 4 additions & 4 deletions examples/create_tx_using_wif/create_tx_using_wif.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ func main() {

// Use a new UTXO
utxo := &bitcoin.Utxo{
TxID: "b7b0650a7c3a1bd4716369783876348b59f5404784970192cec1996e86950576",
Vout: 0,
ScriptSig: "76a9149cbe9f5e72fa286ac8a38052d1d5337aa363ea7f88ac",
Satoshis: 1000,
TxID: "b7b0650a7c3a1bd4716369783876348b59f5404784970192cec1996e86950576",
Vout: 0,
ScriptPubKey: "76a9149cbe9f5e72fa286ac8a38052d1d5337aa363ea7f88ac",
Satoshis: 1000,
}

// Add a pay-to address
Expand Down
8 changes: 4 additions & 4 deletions examples/create_tx_with_change/create_tx_with_change.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ func main() {

// Use a new UTXO
utxo := &bitcoin.Utxo{
TxID: "b7b0650a7c3a1bd4716369783876348b59f5404784970192cec1996e86950576",
Vout: 0,
ScriptSig: "76a9149cbe9f5e72fa286ac8a38052d1d5337aa363ea7f88ac",
Satoshis: 1000,
TxID: "b7b0650a7c3a1bd4716369783876348b59f5404784970192cec1996e86950576",
Vout: 0,
ScriptPubKey: "76a9149cbe9f5e72fa286ac8a38052d1d5337aa363ea7f88ac",
Satoshis: 1000,
}

// Add a pay-to address
Expand Down
10 changes: 5 additions & 5 deletions transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ type FeeAmount struct {

// Utxo is an unspent transaction output
type Utxo struct {
Satoshis uint64 `json:"satoshis"`
ScriptSig string `json:"string"`
TxID string `json:"tx_id"`
Vout uint32 `json:"vout"`
Satoshis uint64 `json:"satoshis"`
ScriptPubKey string `json:"string"`
TxID string `json:"tx_id"`
Vout uint32 `json:"vout"`
}

// PayToAddress is the pay-to-address
Expand Down Expand Up @@ -168,7 +168,7 @@ func CreateTx(utxos []*Utxo, addresses []*PayToAddress,
// Loop all utxos and add to the transaction
var err error
for _, utxo := range utxos {
if err = tx.From(utxo.TxID, utxo.Vout, utxo.ScriptSig, utxo.Satoshis); err != nil {
if err = tx.From(utxo.TxID, utxo.Vout, utxo.ScriptPubKey, utxo.Satoshis); err != nil {
return nil, err
}
totalSatoshis += utxo.Satoshis
Expand Down
Loading

0 comments on commit fd7813e

Please sign in to comment.