remove fee transactions if dcrd rejects it. (#114)
This commit is contained in:
parent
9f48bae78e
commit
873d89e412
@ -95,6 +95,17 @@ func blockConnected() {
|
||||
feeTxHash, err := dcrdClient.SendRawTransaction(ticket.FeeTxHex)
|
||||
if err != nil {
|
||||
log.Errorf("SendRawTransaction error: %v", err)
|
||||
|
||||
// Unset fee related fields and update the database.
|
||||
ticket.FeeTxHex = ""
|
||||
ticket.VotingWIF = ""
|
||||
ticket.VoteChoices = make(map[string]string)
|
||||
|
||||
err = db.UpdateTicket(ticket)
|
||||
if err != nil {
|
||||
log.Errorf("UpdateTicket error: %v", err)
|
||||
}
|
||||
log.Infof("Removed fee transaction for ticket %v", ticket.Hash)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
@ -134,6 +134,7 @@ fields:
|
||||
|
||||
- `ticketconfirmed` is true when the ticket transaction has 6 confirmations.
|
||||
- `feetxreceived` is true when the VSP has received a valid fee transaction.
|
||||
If the broadcast of the fee transaction fails, this will be reset to false.
|
||||
- `feetxbroadcast` is true when the VSP has broadcast the fee transaction.
|
||||
- `feeconfirmed` is true when the fee transaction has 6 confirmations.
|
||||
|
||||
|
||||
@ -220,7 +220,19 @@ findAddress:
|
||||
feeTxHash, err := dcrdClient.SendRawTransaction(payFeeRequest.FeeTx)
|
||||
if err != nil {
|
||||
log.Errorf("SendRawTransaction failed: %v", err)
|
||||
sendError(errInternalError, c)
|
||||
|
||||
// Unset fee related fields and update the database.
|
||||
ticket.FeeTxHex = ""
|
||||
ticket.VotingWIF = ""
|
||||
ticket.VoteChoices = make(map[string]string)
|
||||
|
||||
err = db.UpdateTicket(ticket)
|
||||
if err != nil {
|
||||
log.Errorf("UpdateTicket error: %v", err)
|
||||
}
|
||||
log.Infof("Removed fee transaction for ticket %v", ticket.Hash)
|
||||
|
||||
sendErrorWithMsg("could not broadcast fee transaction", errInvalidFeeTx, c)
|
||||
return
|
||||
}
|
||||
ticket.FeeTxHash = feeTxHash
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user