From 63f1884e1caa60084f3c97c82cd4ee4c0c0b27fc Mon Sep 17 00:00:00 2001 From: Captain Date: Fri, 18 Mar 2022 15:52:33 +0000 Subject: [PATCH] DERO-HE STARGATE Mainnet Release50 --- blockchain/blockchain.go | 2 +- cmd/dero-wallet-cli/easymenu_post_open.go | 29 +++++++++++++++++------ config/version.go | 2 +- p2p/peer_pool.go | 4 ++-- walletapi/daemon_communication.go | 8 +++++-- 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/blockchain/blockchain.go b/blockchain/blockchain.go index ae5cfb1..59d1614 100644 --- a/blockchain/blockchain.go +++ b/blockchain/blockchain.go @@ -1165,7 +1165,7 @@ func (chain *Blockchain) Add_TX_To_Pool(tx *transaction.Transaction) error { if tx.IsRegistration() { // registration tx will not go any forward tx_hash := tx.GetHash() - if chain.simulator == false && !(tx_hash[0] == 0 && tx_hash[1] == 0 && tx_hash[2] <= 0x3) { + if chain.simulator == false && !(tx_hash[0] == 0 && tx_hash[1] == 0 && tx_hash[2] == 0) { return fmt.Errorf("TX doesn't solve Pow") } diff --git a/cmd/dero-wallet-cli/easymenu_post_open.go b/cmd/dero-wallet-cli/easymenu_post_open.go index 0964156..2cb774c 100644 --- a/cmd/dero-wallet-cli/easymenu_post_open.go +++ b/cmd/dero-wallet-cli/easymenu_post_open.go @@ -21,7 +21,7 @@ import "os" import "time" import "fmt" import "errors" - +import "runtime" import "strings" import "path/filepath" @@ -134,15 +134,30 @@ func handle_easymenu_post_open_command(l *readline.Instance, line string) (proce fmt.Fprintf(l.Stderr(), "This will take a couple of minutes.Please wait....\n") var reg_tx *transaction.Transaction - for { - reg_tx = wallet.GetRegistrationTX() - hash := reg_tx.GetHash() + successful_regs := make(chan *transaction.Transaction) - if hash[0] == 0 && hash[1] == 0 && hash[2] <= 0x3 { - break - } + counter := 0 + + for i := 0; i < runtime.GOMAXPROCS(0); i++ { + go func() { + + for counter == 0 { + + lreg_tx := wallet.GetRegistrationTX() + hash := lreg_tx.GetHash() + + if hash[0] == 0 && hash[1] == 0 && hash[2] == 0 { + successful_regs <- lreg_tx + counter++ + break + } + } + }() } + + reg_tx = <-successful_regs + fmt.Fprintf(l.Stderr(), "Registration TXID %s\n", reg_tx.GetHash()) err := wallet.SendTransaction(reg_tx) if err != nil { diff --git a/config/version.go b/config/version.go index 2b11084..0375a02 100644 --- a/config/version.go +++ b/config/version.go @@ -20,4 +20,4 @@ import "github.com/blang/semver/v4" // right now it has to be manually changed // do we need to include git commitsha?? -var Version = semver.MustParse("3.4.138-49.DEROHE.STARGATE+10032022") +var Version = semver.MustParse("3.4.141-50.DEROHE.STARGATE+18032022") diff --git a/p2p/peer_pool.go b/p2p/peer_pool.go index 785b277..1fb369e 100644 --- a/p2p/peer_pool.go +++ b/p2p/peer_pool.go @@ -328,13 +328,13 @@ func get_peer_list_specific(addr string) (peers []Peer_Info) { plist := get_peer_list() sort.SliceStable(plist, func(i, j int) bool { return plist[i].Addr < plist[j].Addr }) - if len(plist) <= 7 { + if len(plist) <= 31 { peers = plist } else { index := sort.Search(len(plist), func(i int) bool { return plist[i].Addr < addr }) for i := range plist { peers = append(peers, plist[(i+index)%len(plist)]) - if len(peers) >= 7 { + if len(peers) >= 31 { break } } diff --git a/walletapi/daemon_communication.go b/walletapi/daemon_communication.go index 97fede0..d9051eb 100644 --- a/walletapi/daemon_communication.go +++ b/walletapi/daemon_communication.go @@ -961,9 +961,13 @@ func (w *Wallet_Memory) synchistory_block(scid crypto.Hash, topo int64) (err err //fmt.Printf("decoding encrypted payload %x\n",tx.Payloads[t].RPCPayload) crypto.EncryptDecryptUserData(crypto.Keccak256(shared_key[:], w.GetAddress().PublicKey.EncodeCompressed()), tx.Payloads[t].RPCPayload) //fmt.Printf("decoded plaintext payload %x\n",tx.Payloads[t].RPCPayload) - sender_idx := uint(tx.Payloads[t].RPCPayload[0]) - if sender_idx <= uint(tx.Payloads[t].Statement.RingSize) { + // if ring size is 2, the other party is the sender so mark it so + if uint(tx.Payloads[t].Statement.RingSize) == 2 { + sender_idx := 0 + if j == 0 { + sender_idx = 1 + } addr := rpc.NewAddressFromKeys((*crypto.Point)(tx.Payloads[t].Statement.Publickeylist[sender_idx])) addr.Mainnet = w.GetNetwork() entry.Sender = addr.String()