From 7394cca069d63368fecd462a1ac4db3ba4026010 Mon Sep 17 00:00:00 2001 From: Inkeliz Date: Wed, 19 Sep 2018 08:11:51 -0300 Subject: [PATCH 1/2] fix: send "receive" to payments made for yourself --- GUI/App/Background/tracker.go | 5 +++-- GUI/App/Background/transaction.go | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/GUI/App/Background/tracker.go b/GUI/App/Background/tracker.go index 44acde0..4cfd3a8 100644 --- a/GUI/App/Background/tracker.go +++ b/GUI/App/Background/tracker.go @@ -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 @@ -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 diff --git a/GUI/App/Background/transaction.go b/GUI/App/Background/transaction.go index 58fc414..ed1c148 100644 --- a/GUI/App/Background/transaction.go +++ b/GUI/App/Background/transaction.go @@ -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 } @@ -141,6 +140,5 @@ func waitVotesConfirmation(tx Block.Transaction, duration time.Duration) bool { } } - ticker.Stop() return false } From 08c994d4f6b553651e51557745e278c5f4c79287 Mon Sep 17 00:00:00 2001 From: Inkeliz Date: Wed, 19 Sep 2018 08:12:39 -0300 Subject: [PATCH 2/2] tweak: accept publish/confirmACK from "unknown" peers. --- Node/nano.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Node/nano.go b/Node/nano.go index 152aedd..2890cbe 100644 --- a/Node/nano.go +++ b/Node/nano.go @@ -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) }