Skip to content

Commit

Permalink
Merge pull request #107 from commerceblock/develop
Browse files Browse the repository at this point in the history
Release 1.0.6 - Minor bump fee issue
  • Loading branch information
Nikos Kostoulas authored Oct 2, 2019
2 parents a11b437 + a9df09b commit b551c41
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions attestation/attestservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ var (

attestDelay time.Duration // handle state delay
confirmTime time.Time // handle confirmation timing

isFeeBumped bool // flag to keep track if the fee has already been bumped
)

// NewAttestService returns a pointer to an AttestService instance
Expand All @@ -118,6 +120,7 @@ func NewAttestService(ctx context.Context, wg *sync.WaitGroup, server *AttestSer

// initiate attestation client
attester := NewAttestClient(config)
isFeeBumped = false

// initiate timing schedules
atimeNewAttestation = DefaultATimeNewAttestation
Expand Down Expand Up @@ -476,6 +479,7 @@ func (s *AttestService) doStateSendAttestation() {
s.state = AStateAwaitConfirmation // update attestation state
attestDelay = ATimeConfirmation // add confirmation waiting time
confirmTime = time.Now() // set time for awaiting confirmation
isFeeBumped = false // reset fee bumped flag
}

// AStateAwaitConfirmation
Expand Down Expand Up @@ -529,9 +533,12 @@ func (s *AttestService) doStateHandleUnconfirmed() {

log.Printf("********** bumping fees for attestation txid: %s\n", s.attestation.Tx.TxHash().String())
currentTx := &s.attestation.Tx
bumpErr := s.attester.bumpAttestationFees(currentTx)
if s.setFailure(bumpErr) {
return // will rebound to init
if !isFeeBumped {
bumpErr := s.attester.bumpAttestationFees(currentTx)
if s.setFailure(bumpErr) {
return // will rebound to init
}
isFeeBumped = true
}

s.attestation.Tx = *currentTx
Expand Down

0 comments on commit b551c41

Please sign in to comment.