Changed TxIn.PreviousOutpoint to TxIn.PreviousOutPoint.
This commit is contained in:
parent
4a2c4a38c9
commit
e6bdb4465d
3 changed files with 23 additions and 23 deletions
18
rpcserver.go
18
rpcserver.go
|
@ -2568,7 +2568,7 @@ func SignRawTransaction(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (in
|
||||||
requested := make(map[btcwire.ShaHash]*pendingTx)
|
requested := make(map[btcwire.ShaHash]*pendingTx)
|
||||||
for _, txIn := range msgTx.TxIn {
|
for _, txIn := range msgTx.TxIn {
|
||||||
// Did we get this txin from the arguments?
|
// Did we get this txin from the arguments?
|
||||||
if _, ok := inputs[txIn.PreviousOutpoint]; ok {
|
if _, ok := inputs[txIn.PreviousOutPoint]; ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2577,17 +2577,17 @@ func SignRawTransaction(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (in
|
||||||
// reference each outpoint once, since anything else is a double
|
// reference each outpoint once, since anything else is a double
|
||||||
// spend. We don't check this ourselves to save having to scan
|
// spend. We don't check this ourselves to save having to scan
|
||||||
// the array, it will fail later if so).
|
// the array, it will fail later if so).
|
||||||
if ptx, ok := requested[txIn.PreviousOutpoint.Hash]; ok {
|
if ptx, ok := requested[txIn.PreviousOutPoint.Hash]; ok {
|
||||||
ptx.inputs = append(ptx.inputs,
|
ptx.inputs = append(ptx.inputs,
|
||||||
txIn.PreviousOutpoint.Index)
|
txIn.PreviousOutPoint.Index)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Never heard of this one before, request it.
|
// Never heard of this one before, request it.
|
||||||
prevHash := &txIn.PreviousOutpoint.Hash
|
prevHash := &txIn.PreviousOutPoint.Hash
|
||||||
requested[txIn.PreviousOutpoint.Hash] = &pendingTx{
|
requested[txIn.PreviousOutPoint.Hash] = &pendingTx{
|
||||||
resp: chainSvr.GetRawTransactionAsync(prevHash),
|
resp: chainSvr.GetRawTransactionAsync(prevHash),
|
||||||
inputs: []uint32{txIn.PreviousOutpoint.Index},
|
inputs: []uint32{txIn.PreviousOutPoint.Index},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2672,13 +2672,13 @@ func SignRawTransaction(w *Wallet, chainSvr *chain.Client, icmd btcjson.Cmd) (in
|
||||||
// reply.
|
// reply.
|
||||||
complete := true
|
complete := true
|
||||||
for i, txIn := range msgTx.TxIn {
|
for i, txIn := range msgTx.TxIn {
|
||||||
input, ok := inputs[txIn.PreviousOutpoint]
|
input, ok := inputs[txIn.PreviousOutPoint]
|
||||||
if !ok {
|
if !ok {
|
||||||
// failure to find previous is actually an error since
|
// failure to find previous is actually an error since
|
||||||
// we failed above if we don't have all the inputs.
|
// we failed above if we don't have all the inputs.
|
||||||
return nil, fmt.Errorf("%s:%d not found",
|
return nil, fmt.Errorf("%s:%d not found",
|
||||||
txIn.PreviousOutpoint.Hash,
|
txIn.PreviousOutPoint.Hash,
|
||||||
txIn.PreviousOutpoint.Index)
|
txIn.PreviousOutPoint.Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up our callbacks that we pass to btcscript so it can
|
// Set up our callbacks that we pass to btcscript so it can
|
||||||
|
|
|
@ -1031,7 +1031,7 @@ func (u *unconfirmedStore) ReadFrom(r io.Reader) (int64, error) {
|
||||||
// itself.
|
// itself.
|
||||||
for _, t := range u.txs {
|
for _, t := range u.txs {
|
||||||
for _, input := range t.tx.MsgTx().TxIn {
|
for _, input := range t.tx.MsgTx().TxIn {
|
||||||
u.previousOutpoints[input.PreviousOutpoint] = t
|
u.previousOutpoints[input.PreviousOutPoint] = t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -424,7 +424,7 @@ func (u *unconfirmedStore) txRecordForInserts(tx *btcutil.Tx) *txRecord {
|
||||||
r = &txRecord{tx: tx}
|
r = &txRecord{tx: tx}
|
||||||
u.txs[*tx.Sha()] = r
|
u.txs[*tx.Sha()] = r
|
||||||
for _, input := range r.Tx().MsgTx().TxIn {
|
for _, input := range r.Tx().MsgTx().TxIn {
|
||||||
u.previousOutpoints[input.PreviousOutpoint] = r
|
u.previousOutpoints[input.PreviousOutPoint] = r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
|
@ -445,7 +445,7 @@ func (s *Store) moveMinedTx(r *txRecord, block *Block) error {
|
||||||
b.txs = append(b.txs, r)
|
b.txs = append(b.txs, r)
|
||||||
|
|
||||||
for _, input := range r.Tx().MsgTx().TxIn {
|
for _, input := range r.Tx().MsgTx().TxIn {
|
||||||
delete(s.unconfirmed.previousOutpoints, input.PreviousOutpoint)
|
delete(s.unconfirmed.previousOutpoints, input.PreviousOutPoint)
|
||||||
|
|
||||||
// For all mined transactions with credits spent by this
|
// For all mined transactions with credits spent by this
|
||||||
// transaction, remove them from the spentBlockOutPoints map
|
// transaction, remove them from the spentBlockOutPoints map
|
||||||
|
@ -453,11 +453,11 @@ func (s *Store) moveMinedTx(r *txRecord, block *Block) error {
|
||||||
// transaction which spending that credit), and update the
|
// transaction which spending that credit), and update the
|
||||||
// credit's spent by tracking with the block key of the
|
// credit's spent by tracking with the block key of the
|
||||||
// newly-mined transaction.
|
// newly-mined transaction.
|
||||||
prev, ok := s.unconfirmed.spentBlockOutPointKeys[input.PreviousOutpoint]
|
prev, ok := s.unconfirmed.spentBlockOutPointKeys[input.PreviousOutPoint]
|
||||||
if !ok {
|
if !ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
delete(s.unconfirmed.spentBlockOutPointKeys, input.PreviousOutpoint)
|
delete(s.unconfirmed.spentBlockOutPointKeys, input.PreviousOutPoint)
|
||||||
delete(s.unconfirmed.spentBlockOutPoints, prev)
|
delete(s.unconfirmed.spentBlockOutPoints, prev)
|
||||||
rr, err := s.lookupBlockTx(prev.BlockTxKey)
|
rr, err := s.lookupBlockTx(prev.BlockTxKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -699,7 +699,7 @@ func (s *Store) findPreviousCredits(tx *btcutil.Tx) ([]Credit, error) {
|
||||||
t := &TxRecord{key, r, s}
|
t := &TxRecord{key, r, s}
|
||||||
c := Credit{t, op.Index}
|
c := Credit{t, op.Index}
|
||||||
creditChans[i] <- createdCredit{credit: c}
|
creditChans[i] <- createdCredit{credit: c}
|
||||||
}(i, txIn.PreviousOutpoint)
|
}(i, txIn.PreviousOutPoint)
|
||||||
}
|
}
|
||||||
spent := make([]Credit, 0, len(inputs))
|
spent := make([]Credit, 0, len(inputs))
|
||||||
for _, c := range creditChans {
|
for _, c := range creditChans {
|
||||||
|
@ -866,7 +866,7 @@ func (s *Store) Rollback(height int32) error {
|
||||||
r.Tx().SetIndex(btcutil.TxIndexUnknown)
|
r.Tx().SetIndex(btcutil.TxIndexUnknown)
|
||||||
s.unconfirmed.txs[*r.Tx().Sha()] = r
|
s.unconfirmed.txs[*r.Tx().Sha()] = r
|
||||||
for _, input := range r.Tx().MsgTx().TxIn {
|
for _, input := range r.Tx().MsgTx().TxIn {
|
||||||
op := input.PreviousOutpoint
|
op := input.PreviousOutPoint
|
||||||
s.unconfirmed.previousOutpoints[op] = r
|
s.unconfirmed.previousOutpoints[op] = r
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,7 +1009,7 @@ func (s *Store) removeDoubleSpends(tx *btcutil.Tx) error {
|
||||||
|
|
||||||
func (u *unconfirmedStore) findDoubleSpend(tx *btcutil.Tx) *txRecord {
|
func (u *unconfirmedStore) findDoubleSpend(tx *btcutil.Tx) *txRecord {
|
||||||
for _, input := range tx.MsgTx().TxIn {
|
for _, input := range tx.MsgTx().TxIn {
|
||||||
if r, ok := u.previousOutpoints[input.PreviousOutpoint]; ok {
|
if r, ok := u.previousOutpoints[input.PreviousOutPoint]; ok {
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1043,14 +1043,14 @@ func (s *Store) removeConflict(r *txRecord) error {
|
||||||
|
|
||||||
// If this tx spends any previous credits, set each unspent.
|
// If this tx spends any previous credits, set each unspent.
|
||||||
for _, input := range r.Tx().MsgTx().TxIn {
|
for _, input := range r.Tx().MsgTx().TxIn {
|
||||||
delete(u.previousOutpoints, input.PreviousOutpoint)
|
delete(u.previousOutpoints, input.PreviousOutPoint)
|
||||||
|
|
||||||
// For all mined transactions with credits spent by this
|
// For all mined transactions with credits spent by this
|
||||||
// conflicting transaction, remove from the bookkeeping maps
|
// conflicting transaction, remove from the bookkeeping maps
|
||||||
// and set each previous record's credit as unspent.
|
// and set each previous record's credit as unspent.
|
||||||
prevKey, ok := u.spentBlockOutPointKeys[input.PreviousOutpoint]
|
prevKey, ok := u.spentBlockOutPointKeys[input.PreviousOutPoint]
|
||||||
if ok {
|
if ok {
|
||||||
delete(u.spentBlockOutPointKeys, input.PreviousOutpoint)
|
delete(u.spentBlockOutPointKeys, input.PreviousOutPoint)
|
||||||
delete(u.spentBlockOutPoints, prevKey)
|
delete(u.spentBlockOutPoints, prevKey)
|
||||||
prev, err := s.lookupBlockTx(prevKey.BlockTxKey)
|
prev, err := s.lookupBlockTx(prevKey.BlockTxKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1066,14 +1066,14 @@ func (s *Store) removeConflict(r *txRecord) error {
|
||||||
//
|
//
|
||||||
// Spend tracking is only handled by these maps, so there is
|
// Spend tracking is only handled by these maps, so there is
|
||||||
// no need to modify the record and unset a spent-by pointer.
|
// no need to modify the record and unset a spent-by pointer.
|
||||||
if _, ok := u.spentUnconfirmed[input.PreviousOutpoint]; ok {
|
if _, ok := u.spentUnconfirmed[input.PreviousOutPoint]; ok {
|
||||||
delete(u.spentUnconfirmed, input.PreviousOutpoint)
|
delete(u.spentUnconfirmed, input.PreviousOutPoint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(u.txs, *r.Tx().Sha())
|
delete(u.txs, *r.Tx().Sha())
|
||||||
for _, input := range r.Tx().MsgTx().TxIn {
|
for _, input := range r.Tx().MsgTx().TxIn {
|
||||||
delete(u.previousOutpoints, input.PreviousOutpoint)
|
delete(u.previousOutpoints, input.PreviousOutPoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue