mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00

* Add fee estimation to wallet * Add fee rate to kaspawallet parse * Update go version * Get rid of golint * Add RBF support to wallet * Fix bump_fee UTXO lookup and fix wrong change address * impl storage mass as per KIP9 * Use CalculateTransactionOverallMass where needed * Some fixes * Minor typos * Fix test * update version * BroadcastRBF -> BroadcastReplacement * rc3 * align proto files to only use camel case (fixed on RK as well) * Rename to FeePolicy and add MaxFee option + todo * apply max fee constrains * increase minChangeTarget to 10kas * fmt * Some fixes * fix description: maximum -> minimum * put min feerate check in the correct location * Fix calculateFeeLimits nil handling * Add validations to CLI flags * Change to rc6 * Add checkTransactionFeeRate * Add failed broadcast transactions on send error` * Fix estimateFee change value * Estimate fee correctly for --send-all * On estimateFee always assume that the recipient has ECDSA address * remove patch version --------- Co-authored-by: Michael Sutton <msutton@cs.huji.ac.il>
34 lines
1023 B
Go
34 lines
1023 B
Go
package server
|
|
|
|
import (
|
|
"encoding/hex"
|
|
"strings"
|
|
)
|
|
|
|
// hexTransactionsSeparator is used to mark the end of one transaction and the beginning of the next one.
|
|
// We use a separator that is not in the hex alphabet, but which will not split selection with a double click
|
|
const hexTransactionsSeparator = "_"
|
|
|
|
func EncodeTransactionsToHex(transactions [][]byte) string {
|
|
transactionsInHex := make([]string, len(transactions))
|
|
for i, transaction := range transactions {
|
|
transactionsInHex[i] = hex.EncodeToString(transaction)
|
|
}
|
|
return strings.Join(transactionsInHex, hexTransactionsSeparator)
|
|
}
|
|
|
|
func DecodeTransactionsFromHex(transactionsHex string) ([][]byte, error) {
|
|
splitTransactionsHexes := strings.Split(transactionsHex, hexTransactionsSeparator)
|
|
transactions := make([][]byte, len(splitTransactionsHexes))
|
|
|
|
var err error
|
|
for i, transactionHex := range splitTransactionsHexes {
|
|
transactions[i], err = hex.DecodeString(transactionHex)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
return transactions, nil
|
|
}
|