mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-28 16:01:29 +00:00
Read and write tx fee from SendTxs
This commit is contained in:
parent
d89cdaca08
commit
ab623ec9e0
1 changed files with 6 additions and 6 deletions
12
tx/tx.go
12
tx/tx.go
|
@ -60,11 +60,11 @@ type RecvTx struct {
|
||||||
|
|
||||||
type SendTx struct {
|
type SendTx struct {
|
||||||
TxHash btcwire.ShaHash
|
TxHash btcwire.ShaHash
|
||||||
Amt int64 // Measured in Satoshis
|
Fee int64 // Measured in Satoshis
|
||||||
SenderAddr [ripemd160.Size]byte
|
SenderAddr [ripemd160.Size]byte
|
||||||
ReceiverAddrs []struct {
|
ReceiverAddrs []struct {
|
||||||
Addr [ripemd160.Size]byte
|
Addr [ripemd160.Size]byte
|
||||||
Amt int64
|
Amt int64 // Measured in Satoshis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,14 +347,14 @@ func (tx *RecvTx) WriteTo(w io.Writer) (n int64, err error) {
|
||||||
// ReadFrom satisifies the io.WriterTo interface. A SendTx is read
|
// ReadFrom satisifies the io.WriterTo interface. A SendTx is read
|
||||||
// from r with the format:
|
// from r with the format:
|
||||||
//
|
//
|
||||||
// [TxHash (32 bytes), SenderAddr (20 bytes), len(ReceiverAddrs) (4 bytes), ReceiverAddrs[Addr (20 bytes), Amt (8 bytes)]...]
|
// [TxHash (32 bytes), Fee (8 bytes), SenderAddr (20 bytes), len(ReceiverAddrs) (4 bytes), ReceiverAddrs[Addr (20 bytes), Amt (8 bytes)]...]
|
||||||
//
|
//
|
||||||
// Each field is read little endian.
|
// Each field is read little endian.
|
||||||
func (tx *SendTx) ReadFrom(r io.Reader) (n int64, err error) {
|
func (tx *SendTx) ReadFrom(r io.Reader) (n int64, err error) {
|
||||||
var nReceivers uint32
|
var nReceivers uint32
|
||||||
datas := []interface{}{
|
datas := []interface{}{
|
||||||
&tx.TxHash,
|
&tx.TxHash,
|
||||||
&tx.Amt,
|
&tx.Fee,
|
||||||
&tx.SenderAddr,
|
&tx.SenderAddr,
|
||||||
&nReceivers,
|
&nReceivers,
|
||||||
}
|
}
|
||||||
|
@ -395,7 +395,7 @@ func (tx *SendTx) ReadFrom(r io.Reader) (n int64, err error) {
|
||||||
// WriteTo satisifies the io.WriterTo interface. A RecvTx is written to
|
// WriteTo satisifies the io.WriterTo interface. A RecvTx is written to
|
||||||
// w in the format:
|
// w in the format:
|
||||||
//
|
//
|
||||||
// [TxHash (32 bytes), SenderAddr (20 bytes), len(ReceiverAddrs) (4 bytes), ReceiverAddrs[Addr (20 bytes), Amt (8 bytes)]...]
|
// [TxHash (32 bytes), Fee (8 bytes), SenderAddr (20 bytes), len(ReceiverAddrs) (4 bytes), ReceiverAddrs[Addr (20 bytes), Amt (8 bytes)]...]
|
||||||
//
|
//
|
||||||
// Each field is written little endian.
|
// Each field is written little endian.
|
||||||
func (tx *SendTx) WriteTo(w io.Writer) (n int64, err error) {
|
func (tx *SendTx) WriteTo(w io.Writer) (n int64, err error) {
|
||||||
|
@ -405,7 +405,7 @@ func (tx *SendTx) WriteTo(w io.Writer) (n int64, err error) {
|
||||||
}
|
}
|
||||||
datas := []interface{}{
|
datas := []interface{}{
|
||||||
&tx.TxHash,
|
&tx.TxHash,
|
||||||
&tx.Amt,
|
&tx.Fee,
|
||||||
&tx.SenderAddr,
|
&tx.SenderAddr,
|
||||||
nReceivers,
|
nReceivers,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue