From 2a0b05e9be89c9831e2ca8c6ed94db72c7b320ee Mon Sep 17 00:00:00 2001 From: Philemon Ukane Date: Tue, 26 Nov 2024 16:57:33 +0100 Subject: [PATCH] Use `core.Active` to check for active order (#704) * Use core.Active to check or active order Signed-off-by: Philemon Ukane * keep core.ActiveOrders Signed-off-by: Philemon Ukane * update go.mod to latest dex master Signed-off-by: Philemon Ukane --------- Signed-off-by: Philemon Ukane --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- libwallet/assets/dcr/dex_wallet.go | 2 +- libwallet/dex_interface.go | 1 + ui/window.go | 8 +------- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/go.mod b/go.mod index 12922d35b..b4d67728d 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( decred.org/dcrdex v1.0.0 - decred.org/dcrwallet/v4 v4.1.3 + decred.org/dcrwallet/v4 v4.2.0 gioui.org v0.7.0 git.wow.st/gmp/jni v0.0.0-20210610011705-34026c7e22d0 github.com/JohannesKaufmann/html-to-markdown v1.2.1 @@ -67,7 +67,7 @@ require ( ) require ( - decred.org/cspp/v2 v2.2.0 // indirect + decred.org/cspp/v2 v2.3.0 // indirect decred.org/dcrwallet v1.7.0 // indirect gioui.org/cpu v0.0.0-20210817075930-8d6a761490d2 // indirect gioui.org/shader v1.0.8 // indirect @@ -108,7 +108,7 @@ require ( github.com/decred/dcrd/blockchain/standalone/v2 v2.2.1 // indirect github.com/decred/dcrd/certgen v1.2.0 // indirect github.com/decred/dcrd/container/lru v1.0.0 // indirect - github.com/decred/dcrd/crypto/blake256 v1.0.1 // indirect + github.com/decred/dcrd/crypto/blake256 v1.1.0 // indirect github.com/decred/dcrd/crypto/rand v1.0.0 // indirect github.com/decred/dcrd/crypto/ripemd160 v1.0.2 // indirect github.com/decred/dcrd/database/v2 v2.0.2 // indirect @@ -121,7 +121,7 @@ require ( github.com/decred/dcrd/gcs/v2 v2.1.0 // indirect github.com/decred/dcrd/gcs/v4 v4.1.0 // indirect github.com/decred/dcrd/lru v1.1.2 // indirect - github.com/decred/dcrd/mixing v0.4.1 // indirect + github.com/decred/dcrd/mixing v0.4.2 // indirect github.com/decred/dcrd/rpcclient/v8 v8.0.1 // indirect github.com/decred/dcrd/txscript/v3 v3.0.0 // indirect github.com/decred/dcrtime v0.0.0-20191018193024-8d8b4ef0458e // indirect @@ -225,4 +225,4 @@ require ( replace github.com/lib/pq => github.com/lib/pq v1.10.4 // https://github.com/ukane-philemon/dcrdex/tree/btc-node -replace decred.org/dcrdex v1.0.0 => github.com/ukane-philemon/dcrdex v0.0.0-20240906090529-912997266ecf +replace decred.org/dcrdex v1.0.0 => github.com/ukane-philemon/dcrdex v0.0.0-20241119213828-522570591e38 diff --git a/go.sum b/go.sum index 70d063e9e..052ca180d 100644 --- a/go.sum +++ b/go.sum @@ -81,12 +81,12 @@ contrib.go.opencensus.io/exporter/stackdriver v0.13.12/go.mod h1:mmxnWlrvrFdpiOH contrib.go.opencensus.io/integrations/ocsql v0.1.4/go.mod h1:8DsSdjz3F+APR+0z0WkU1aRorQCFfRxvqjUUPMbF3fE= contrib.go.opencensus.io/resource v0.1.1/go.mod h1:F361eGI91LCmW1I/Saf+rX0+OFcigGlFvXwEGEnkRLA= decred.org/cspp v0.3.0/go.mod h1:UygjYilC94dER3BEU65Zzyoqy9ngJfWCD2rdJqvUs2A= -decred.org/cspp/v2 v2.2.0 h1:VSOUC1w0Wo+QOGS0r1XO6TLnO16X67KuvpDmRRYyr08= -decred.org/cspp/v2 v2.2.0/go.mod h1:9nO3bfvCheOPIFZw5f6sRQ42CjBFB5RKSaJ9Iq6G4MA= +decred.org/cspp/v2 v2.3.0 h1:GC8emJnLbOVAkgBTHK/1wy6o/m0AVsN1r4m1ZnZZWjo= +decred.org/cspp/v2 v2.3.0/go.mod h1:9nO3bfvCheOPIFZw5f6sRQ42CjBFB5RKSaJ9Iq6G4MA= decred.org/dcrwallet v1.7.0 h1:U/ew00YBdUlx3rJAynt2OdKDgGzBKK4O89FijBq8iVg= decred.org/dcrwallet v1.7.0/go.mod h1:hNOGyvH53gWdgFB601/ubGRzCPfPtWnEVAi9Grs90y4= -decred.org/dcrwallet/v4 v4.1.3 h1:XKxDbvPAHXfLunYNbCIEh2TYCwZ039hvUJCcTpfBAMg= -decred.org/dcrwallet/v4 v4.1.3/go.mod h1:hqAijllSbuhT4dZofpufi/08kGDXVUJUnPNtmqnJq4A= +decred.org/dcrwallet/v4 v4.2.0 h1:V+RO80FnRuJCPoOQIFKb26JM5Yn1+oXS11x8zZPR1T4= +decred.org/dcrwallet/v4 v4.2.0/go.mod h1:VLK+FIBD4n/K7v5Sc+rYcSB4j3PiGm1MKDpxXjrlE1s= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= eliasnaur.com/font v0.0.0-20230308162249-dd43949cb42d h1:ARo7NCVvN2NdhLlJE9xAbKweuI9L6UgfTbYb0YwPacY= eliasnaur.com/font v0.0.0-20230308162249-dd43949cb42d/go.mod h1:OYVuxibdk9OSLX8vAqydtRPP87PyTFcT9uH3MlEGBQA= @@ -437,8 +437,8 @@ github.com/decred/dcrd/connmgr/v3 v3.1.2/go.mod h1:tdbErFiNOuy/sHrX2mwaOk+r1HLs3 github.com/decred/dcrd/container/lru v1.0.0 h1:7foQymtbu18aQWYiY9RnNIeE+kvpiN+fiBQ3+viyJjI= github.com/decred/dcrd/container/lru v1.0.0/go.mod h1:vlPwj0l+IzAHhQSsbgQnJgO5Cte78+yI065V+Mc5PRQ= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= -github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/crypto/blake256 v1.1.0 h1:zPMNGQCm0g4QTY27fOCorQW7EryeQ/U0x++OzVrdms8= +github.com/decred/dcrd/crypto/blake256 v1.1.0/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/crypto/rand v1.0.0 h1:Ah9Asl36OZt09sGSMbJZuL1HfwGdlC38q/ZUeLDVKRg= github.com/decred/dcrd/crypto/rand v1.0.0/go.mod h1:coa7BbxSTiKH6esi257plGfMFYuGL4MTbQlLYnOdzpE= github.com/decred/dcrd/crypto/ripemd160 v1.0.0/go.mod h1:F0H8cjIuWTRoixr/LM3REB8obcWkmYx0gbxpQWR8RPg= @@ -512,8 +512,8 @@ github.com/decred/dcrd/lru v1.1.2/go.mod h1:gEdCVgXs1/YoBvFWt7Scgknbhwik3FgVSzln github.com/decred/dcrd/mempool v1.0.1/go.mod h1:r+/DGiiluXi1EyMCCPPH58Qu+rsr8nZv0DialAG5VZQ= github.com/decred/dcrd/mining v1.0.0/go.mod h1:VA5H4zhJgXb8LK5lqM5H58dhMRXJRcaQQoX3G8QRpP8= github.com/decred/dcrd/mining v1.0.1/go.mod h1:+CSOLPi7TM8OlQg7mJ7XzWLXCDb4nHK8R6cvXOzhEoU= -github.com/decred/dcrd/mixing v0.4.1 h1:W8ZCzhmNyzG1xjJMA3L6FOElmp98Ttnk3dDUxD6irAE= -github.com/decred/dcrd/mixing v0.4.1/go.mod h1:ySvVwTZyVz5YvevA6YjPrB6pJEwTm7IkHohTfaiHh2c= +github.com/decred/dcrd/mixing v0.4.2 h1:mpt2pNIFTI6L1hXrieAWJTQJv5t9WzHcNnhI+tnAG90= +github.com/decred/dcrd/mixing v0.4.2/go.mod h1:VF87lOn41kitgWVOwmXoB4qMYF7+bxItZXyw4JfW3EQ= github.com/decred/dcrd/rpc/jsonrpc/types v1.0.0/go.mod h1:0dwmpIP21tJxjg/UuUHWIFMbfoLv2ifCBMokNKlOxpo= github.com/decred/dcrd/rpc/jsonrpc/types/v2 v2.3.0/go.mod h1:krn89ZOgSa8yc7sA4WpDK95p61NnjNWFkNlMnGrKbMc= github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.3.0 h1:l0DnCcILTNrpy8APF3FLN312ChpkQaAuW30aC/RgBaw= @@ -1564,8 +1564,8 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ukane-philemon/dcrdex v0.0.0-20240906090529-912997266ecf h1:pyg1NZKYwUpI1iMAjmv/Mq0aT8LrEzDg/TX6OmkbrIA= -github.com/ukane-philemon/dcrdex v0.0.0-20240906090529-912997266ecf/go.mod h1:EDykASO1l5Uh4QVfbbuz16Ed9pw6WZf0NuFGBkSrkIw= +github.com/ukane-philemon/dcrdex v0.0.0-20241119213828-522570591e38 h1:eGmLp6BsR4+guJcSK1np94t6Pf0hG2a2iNt7c/ZrMKM= +github.com/ukane-philemon/dcrdex v0.0.0-20241119213828-522570591e38/go.mod h1:gdf3lZ3aBl6QsmZCP6ZACRd3Ih8SG+er9BK8V4pq3LQ= github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= diff --git a/libwallet/assets/dcr/dex_wallet.go b/libwallet/assets/dcr/dex_wallet.go index 951f5f281..0bc03677f 100644 --- a/libwallet/assets/dcr/dex_wallet.go +++ b/libwallet/assets/dcr/dex_wallet.go @@ -465,7 +465,7 @@ func (dw *DEXWallet) GetTransaction(ctx context.Context, txHash *chainhash.Hash) } ret := dexdcr.WalletTransaction{ - Hex: b.String(), + BlockHash: b.String(), } if txd.Block.Height != -1 { diff --git a/libwallet/dex_interface.go b/libwallet/dex_interface.go index 0e838a411..800d94a70 100644 --- a/libwallet/dex_interface.go +++ b/libwallet/dex_interface.go @@ -31,6 +31,7 @@ type DEXClient interface { SyncBook(dex string, base, quote uint32) (*orderbook.OrderBook, core.BookFeed, error) Orders(filter *core.OrderFilter) ([]*core.Order, error) ActiveOrders() (map[string][]*core.Order, map[string][]*core.InFlightOrder, error) + Active() bool Trade(pw []byte, form *core.TradeForm) (*core.Order, error) // TradeAsync is like Trade but a temporary order is returned before order // server validation. This helps handle some issues related to UI/UX where diff --git a/ui/window.go b/ui/window.go index 3361da465..04aab7ce7 100644 --- a/ui/window.go +++ b/ui/window.go @@ -198,13 +198,7 @@ func (win *Window) HandleEvents() { return } - ord, inflight, err := win.load.AssetsManager.DexClient().ActiveOrders() - if err != nil { - log.Errorf("AssetsManager.DexClient().ActiveOrders error: %v", err) - return - } - - if len(ord) == 0 && len(inflight) == 0 { + if !win.load.AssetsManager.DexClient().Active() { doShutdown() return }