From 055725a2b2a5459ca5870ec62d694883a2195832 Mon Sep 17 00:00:00 2001 From: JoeGruff Date: Thu, 20 Jun 2024 14:12:10 +0900 Subject: [PATCH] cgo: Use int64 for birthday time. --- cgo/sync.go | 5 ++++- cgo/types.go | 11 +++++------ go.mod | 10 ++++++---- go.sum | 20 ++++++++++++-------- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/cgo/sync.go b/cgo/sync.go index 239fd55..0b67535 100644 --- a/cgo/sync.go +++ b/cgo/sync.go @@ -231,11 +231,14 @@ func birthState(cName *C.char) *C.char { if err != nil { return errCResponse("wallet.BirthState error: %v", err) } + if bs == nil { + return errCResponse("birth state is nil for wallet %q", goString(cName)) + } bsRes := &BirthdayState{ Hash: bs.Hash.String(), Height: bs.Height, - Time: bs.Time, + Time: bs.Time.Unix(), SetFromHeight: bs.SetFromHeight, SetFromTime: bs.SetFromTime, } diff --git a/cgo/types.go b/cgo/types.go index a9de37c..9ac6415 100644 --- a/cgo/types.go +++ b/cgo/types.go @@ -4,7 +4,6 @@ import "C" import ( "encoding/json" "fmt" - "time" wallettypes "decred.org/dcrwallet/v4/rpc/jsonrpc/types" ) @@ -140,9 +139,9 @@ type ListTransactionRes struct { } type BirthdayState struct { - Hash string `json:"hash"` - Height uint32 `json:"height"` - Time time.Time `json:"time"` - SetFromHeight bool `json:"setfromheight"` - SetFromTime bool `json:"setfromtime"` + Hash string `json:"hash"` + Height uint32 `json:"height"` + Time int64 `json:"time"` + SetFromHeight bool `json:"setfromheight"` + SetFromTime bool `json:"setfromtime"` } diff --git a/go.mod b/go.mod index 6c3699d..2c13f45 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/decred/libwallet require ( decred.org/dcrdex v0.0.0-20240415203145-79c4689fd164 - decred.org/dcrwallet/v4 v4.1.1 + decred.org/dcrwallet/v4 v4.1.2 github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f github.com/decred/dcrd/addrmgr/v2 v2.0.4 github.com/decred/dcrd/chaincfg/chainhash v1.0.4 @@ -15,7 +15,7 @@ require ( github.com/decred/slog v1.2.0 github.com/jrick/logrotate v1.0.0 github.com/kevinburke/nacl v0.0.0-20210405173606-cd9060f5f776 - golang.org/x/crypto v0.23.0 + golang.org/x/crypto v0.24.0 ) require ( @@ -26,7 +26,9 @@ require ( github.com/decred/base58 v1.0.5 // indirect github.com/decred/dcrd/blockchain/stake/v5 v5.0.1 // indirect github.com/decred/dcrd/blockchain/standalone/v2 v2.2.1 // 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/rand v1.0.0 // indirect github.com/decred/dcrd/crypto/ripemd160 v1.0.2 // indirect github.com/decred/dcrd/database/v3 v3.0.2 // indirect github.com/decred/dcrd/dcrec v1.0.1 // indirect @@ -34,7 +36,7 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect github.com/decred/dcrd/dcrjson/v4 v4.1.0 // indirect github.com/decred/dcrd/gcs/v4 v4.1.0 // indirect - github.com/decred/dcrd/mixing v0.3.0 // indirect + github.com/decred/dcrd/mixing v0.4.0 // indirect github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.3.0 // indirect github.com/decred/go-socks v1.1.0 // indirect github.com/gorilla/websocket v1.5.1 // indirect @@ -45,7 +47,7 @@ require ( go.etcd.io/bbolt v1.3.8 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.20.0 // indirect + golang.org/x/sys v0.21.0 // indirect lukechampine.com/blake3 v1.3.0 // indirect ) diff --git a/go.sum b/go.sum index f395333..1f94bc8 100644 --- a/go.sum +++ b/go.sum @@ -2,8 +2,8 @@ decred.org/cspp/v2 v2.2.0 h1:VSOUC1w0Wo+QOGS0r1XO6TLnO16X67KuvpDmRRYyr08= decred.org/cspp/v2 v2.2.0/go.mod h1:9nO3bfvCheOPIFZw5f6sRQ42CjBFB5RKSaJ9Iq6G4MA= decred.org/dcrdex v0.0.0-20240415203145-79c4689fd164 h1:ImD+Zui9lnZhVYacX0x9ki1M95hTYxwASl2PvVoAc2M= decred.org/dcrdex v0.0.0-20240415203145-79c4689fd164/go.mod h1:rvIXDCS3B3gbu8b0tKDvNU664nC+/zVl3ivs6AeA2V8= -decred.org/dcrwallet/v4 v4.1.1 h1:imwPBboytp1PH6V8q7/JLTHiKgj/Scq9a3I1WmnJv0Y= -decred.org/dcrwallet/v4 v4.1.1/go.mod h1:WxerkRcUGVreJsAI0ptCBPUujPUmWncbdYbme8Kl5r0= +decred.org/dcrwallet/v4 v4.1.2 h1:NESPkLLpLXwrsWRmeDSLM/O5NaSMFSyjQrG+9m0iuzk= +decred.org/dcrwallet/v4 v4.1.2/go.mod h1:Ivu6THxbdMLGxKTa/eJT7vDr2awmKok7gEh82oCxs/s= github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 h1:w1UutsfOrms1J05zt7ISrnJIXKzwaspym5BTKGx93EI= github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412/go.mod h1:WPjqKcmVOxf0XSf3YxCJs6N6AOSrOx3obionmG7T0y0= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= @@ -30,8 +30,12 @@ github.com/decred/dcrd/chaincfg/v3 v3.2.1 h1:x9zKJaU24WAKbxAR1UyFKHlM3oJgP0H9Lod github.com/decred/dcrd/chaincfg/v3 v3.2.1/go.mod h1:SDCWDtY7BLj0leXc9FuoA1YjSVKyCIBVAyxwZn6+sXc= github.com/decred/dcrd/connmgr/v3 v3.1.2 h1:+xNopie2L3YYwwkz51k0h/pASATOBzHtl2O8eodGg04= github.com/decred/dcrd/connmgr/v3 v3.1.2/go.mod h1:tdbErFiNOuy/sHrX2mwaOk+r1HLs3EBz2EGxsocMPe4= +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.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= github.com/decred/dcrd/crypto/blake256 v1.0.1/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.2 h1:TvGTmUBHDU75OHro9ojPLK+Yv7gDl2hnUvRocRCjsys= github.com/decred/dcrd/crypto/ripemd160 v1.0.2/go.mod h1:uGfjDyePSpa75cSQLzNdVmWlbQMBuiJkvXw/MNKRY4M= github.com/decred/dcrd/database/v3 v3.0.2 h1:rgP7XNZemTs8ZC7bnTKO8JO79Woj5nq+yQYmB9ry7yM= @@ -50,8 +54,8 @@ github.com/decred/dcrd/gcs/v4 v4.1.0 h1:tpW7JW53yJZlgNwl/n2NL1b8NxHaIPRUyNuLMkB/ github.com/decred/dcrd/gcs/v4 v4.1.0/go.mod h1:nPTbGM/I3Ihe5KFvUmxZEqQP/jDZQjQ63+WEi/f4lqU= github.com/decred/dcrd/hdkeychain/v3 v3.1.2 h1:x25WuuE7zM/20EynuVMyOhL0K8BwGBBsexGq8xTiHFA= github.com/decred/dcrd/hdkeychain/v3 v3.1.2/go.mod h1:FnNJmZ7jqUDeAo6/c/xkQi5cuxh3EWtJeMmW6/Z8lcc= -github.com/decred/dcrd/mixing v0.3.0 h1:eUHpTdwTqXUllnn1ZYLfxucW/2UOkMmx4CyztipTJ9g= -github.com/decred/dcrd/mixing v0.3.0/go.mod h1:W3K7yJKmoI03G2U5Yw+HSRNe6lLBegi63ZR6fFLnM9c= +github.com/decred/dcrd/mixing v0.4.0 h1:XblHAND4Vt5owVUvjPorDg30eWT53DpCZs6VF7U1t6U= +github.com/decred/dcrd/mixing v0.4.0/go.mod h1:ySvVwTZyVz5YvevA6YjPrB6pJEwTm7IkHohTfaiHh2c= github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.3.0 h1:l0DnCcILTNrpy8APF3FLN312ChpkQaAuW30aC/RgBaw= github.com/decred/dcrd/rpc/jsonrpc/types/v4 v4.3.0/go.mod h1:j+kkRPXPJB5S9VFOsx8SQLcU7PTFkPKRc1aCHN4ENzA= github.com/decred/dcrd/txscript/v4 v4.1.1 h1:R4M2+jMujgQA91899SkL0cW66d6DC76Gx+1W1oEHjc0= @@ -87,15 +91,15 @@ github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= -golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=