Skip to content

Commit

Permalink
Accept ConfirmACK from "unknown" peers
Browse files Browse the repository at this point in the history
Accept ConfirmACK from "unknown" peers
  • Loading branch information
inkeliz authored Sep 19, 2018
2 parents 47fe65a + 08c994d commit 8e3e052
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions GUI/App/Background/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ func StartAddress(w *DOM.Window) error {

}

go realtimeUpdate(w)

Storage.TransactionStorage.Add(txs...)
DOM.UpdateAmount(w)

go realtimeUpdate(w)
go pending(w)

return nil
Expand Down Expand Up @@ -112,7 +113,7 @@ func realtimeUpdate(w *DOM.Window) {
func acceptPending(w *DOM.Window, tx Block.Transaction) {
hash := tx.Hash()

if waitVotesConfirmation(tx, 6 * time.Minute) {
if waitVotesConfirmation(tx, 6*time.Minute) {
amount, err := Node.GetAmount(Connection, tx)
if err != nil {
return
Expand Down
4 changes: 1 addition & 3 deletions GUI/App/Background/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ func waitVotesConfirmation(tx Block.Transaction, duration time.Duration) bool {
start := time.Now()
hash := tx.Hash()

ticker := time.NewTicker(1 * time.Second)
for range ticker.C {
for range time.Tick(2 * time.Second) {
if Storage.TransactionStorage.IsConfirmed(&hash, &Storage.Configuration.Account.Quorum) {
return true
}
Expand All @@ -141,6 +140,5 @@ func waitVotesConfirmation(tx Block.Transaction, duration time.Duration) bool {
}
}

ticker.Stop()
return false
}
4 changes: 4 additions & 0 deletions Node/nano.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ func (srv *Server) listenUDP() {
}
} else {
switch h.MessageType {
case Packets.Publish:
srv.PublishHandler(srv, dest, h, b)
case Packets.ConfirmACK:
srv.ConfirmACKHandler(srv, dest, h, b)
case Packets.NodeHandshake:
srv.HandshakeHandler(srv, dest, h, b)
}
Expand Down

0 comments on commit 8e3e052

Please sign in to comment.