Skip to content

Commit

Permalink
zec: Satisfy WalletHistorian.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeGruffins committed Jun 4, 2024
1 parent 5cc1e8b commit b1a853c
Show file tree
Hide file tree
Showing 3 changed files with 820 additions and 9 deletions.
29 changes: 27 additions & 2 deletions client/asset/zec/transparent_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,25 @@ func lockUnspent(c rpcCaller, unlock bool, ops []*btc.Output) error {
return err
}

func getTransaction(c rpcCaller, txHash *chainhash.Hash) (*dexzec.Tx, error) {
type zTx struct {
*dexzec.Tx
blockHash string
}

func getTransaction(c rpcCaller, txHash *chainhash.Hash) (*zTx, error) {
var tx btc.GetTransactionResult
if err := c.CallRPC("gettransaction", []any{txHash.String()}, &tx); err != nil {
return nil, err
}
return dexzec.DeserializeTx(tx.Bytes)
dexzecTx, err := dexzec.DeserializeTx(tx.Bytes)
if err != nil {
return nil, err
}
zt := &zTx{
Tx: dexzecTx,
blockHash: tx.BlockHash,
}
return zt, nil
}

func getRawTransaction(c rpcCaller, txHash *chainhash.Hash) ([]byte, error) {
Expand Down Expand Up @@ -347,3 +360,15 @@ func syncStatus(c rpcCaller) (*btc.SyncStatus, error) {
Syncing: chainInfo.Syncing(),
}, nil
}

type listSinceBlockRes struct {
Transactions []btcjson.ListTransactionsResult `json:"transactions"`
}

func listSinceBlock(c rpcCaller, txHash *chainhash.Hash) ([]btcjson.ListTransactionsResult, error) {
var res listSinceBlockRes
if err := c.CallRPC("listsinceblock", []any{txHash.String()}, &res); err != nil {
return nil, err
}
return res.Transactions, nil
}
Loading

0 comments on commit b1a853c

Please sign in to comment.