wallet: for ineutrino back-end insert all broadcast transactions into txstore
This commit is contained in:
parent
436aa312d2
commit
ee841b07cf
1 changed files with 23 additions and 1 deletions
|
@ -2510,7 +2510,7 @@ func (w *Wallet) SignTransaction(tx *wire.MsgTx, hashType txscript.SigHashType,
|
|||
}
|
||||
|
||||
// PublishTransaction sends the transaction to the consensus RPC server so it
|
||||
// can be propigated to other nodes and eventually mined.
|
||||
// can be propagated to other nodes and eventually mined.
|
||||
//
|
||||
// This function is unstable and will be removed once syncing code is moved out
|
||||
// of the wallet.
|
||||
|
@ -2520,6 +2520,28 @@ func (w *Wallet) PublishTransaction(tx *wire.MsgTx) error {
|
|||
return err
|
||||
}
|
||||
|
||||
switch server.(type) {
|
||||
// If our chain backend is neutrino, then we'll add this as an
|
||||
// unconfirmed transaction into the transaction store. Otherwise, we
|
||||
// won't eve be notified of it's acceptance, meaning we won't attempt
|
||||
// to re-broadcast.
|
||||
case *chain.NeutrinoClient:
|
||||
rec, err := wtxmgr.NewTxRecordFromMsgTx(
|
||||
tx, time.Now(),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error {
|
||||
txmgrNs := tx.ReadWriteBucket(wtxmgrNamespaceKey)
|
||||
|
||||
return w.TxStore.InsertTx(txmgrNs, rec, nil)
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
_, err = server.SendRawTransaction(tx, false)
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue