Skip to content

Commit

Permalink
get trade_simnet_test working again
Browse files Browse the repository at this point in the history
Clean up the simnet tests and get them working again by tricking
(*Core).locallyLocked to block swaps as needed.

Give the secondary (non-alpha) simnet harnesses more money.
  • Loading branch information
chappjc committed Dec 21, 2020
1 parent 0de8945 commit e198b1f
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 159 deletions.
5 changes: 4 additions & 1 deletion client/asset/btc/btc.go
Expand Up @@ -576,7 +576,10 @@ func (btc *ExchangeWallet) SyncStatus() (bool, float32, error) {
if chainInfo.InitialBlockDownload || toGo > 1 {
ogTip := atomic.LoadInt64(&btc.tipAtConnect)
totalToSync := chainInfo.Headers - ogTip
progress := 1 - (float32(toGo) / float32(totalToSync))
var progress float32 = 1
if totalToSync > 0 {
progress = 1 - (float32(toGo) / float32(totalToSync))
}
return false, progress, nil
}
return true, 1, nil
Expand Down
6 changes: 3 additions & 3 deletions client/asset/dcr/dcr.go
Expand Up @@ -2055,7 +2055,7 @@ func (dcr *ExchangeWallet) signTx(baseTx *wire.MsgTx) (*wire.MsgTx, error) {

for i := range res.Errors {
sigErr := &res.Errors[i]
dcr.log.Errorf("Signing %v:%d, seq = %d, sigScript = %v, failed: %v",
dcr.log.Errorf("Signing %v:%d, seq = %d, sigScript = %v, failed: %v (is wallet locked?)",
sigErr.TxID, sigErr.Vout, sigErr.Sequence, sigErr.ScriptSig, sigErr.Error)
// Will be incomplete below, so log each SignRawTransactionError and move on.
}
Expand All @@ -2068,7 +2068,7 @@ func (dcr *ExchangeWallet) signTx(baseTx *wire.MsgTx) (*wire.MsgTx, error) {
if !res.Complete {
dcr.log.Errorf("Incomplete raw transaction signatures (input tx: %x / incomplete signed tx: %x): ",
dcr.wireBytes(baseTx), dcr.wireBytes(signedTx))
return nil, fmt.Errorf("incomplete raw tx signatures")
return nil, fmt.Errorf("incomplete raw tx signatures (is wallet locked?)")
}

return signedTx, nil
Expand Down Expand Up @@ -2277,7 +2277,7 @@ func (dcr *ExchangeWallet) getKeys(addr dcrutil.Address) (*secp256k1.PrivateKey,
addrV2, _ := dcrutil.DecodeAddress(addr.String(), chainParams) // just be sure it's dcrutil/v2
wif, err := dcr.node.DumpPrivKey(addrV2, chainParams.PrivateKeyID)
if err != nil {
return nil, nil, err
return nil, nil, fmt.Errorf("%w (is wallet locked?)", err)
}

priv := secp256k1.PrivKeyFromBytes(wif.PrivKey.Serialize())
Expand Down
4 changes: 2 additions & 2 deletions client/comms/wsconn.go
Expand Up @@ -513,8 +513,8 @@ func (conn *wsConn) RequestWithTimeout(msg *msgjson.Message, f func(*msgjson.Mes
// Neither expire nor the handler should run. Stop the expire timer
// created by logReq and delete the response handler it added. The
// caller receives a non-nil error to deal with it.
conn.log.Debugf("(*wsConn).Request(route '%s') Send error, unregistering msg ID %d handler",
msg.Route, msg.ID)
conn.log.Errorf("(*wsConn).Request(route '%s') Send error (%v), unregistering msg ID %d handler",
msg.Route, err, msg.ID)
conn.respHandler(msg.ID) // drop the responseHandler logged by logReq that is no longer necessary
}
return err
Expand Down

0 comments on commit e198b1f

Please sign in to comment.