Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build and upload assets
on:
release:
types: [ published ]
types: [published]

jobs:
build:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.1
go-version: 1.24.1

- name: Update sources
if: matrix.TARGET == 'linux/aarch64' || matrix.TARGET == 'windows/x64'
Expand All @@ -43,7 +43,7 @@ jobs:
# `-extldflags=-static` - means static link everything,
# `-tags netgo,osusergo` means use pure go replacements for "os/user" and "net"
# `-s -w` strips the binary to produce smaller size binaries
go build -v -ldflags="-s -w -extldflags=-static" -tags netgo,osusergo -o ./bin/ . ./cmd/...
go build -v -ldflags="-s -w -extldflags=-static" -tags netgo,osusergo -o ./bin/ ./cmd/...
archive="bin/karlsend-${{ github.event.release.tag_name }}-linux-x86_64.zip"
asset_name="karlsend-${{ github.event.release.tag_name }}-linux-x86_64.zip"
zip -r "${archive}" ./bin/*
Expand All @@ -62,7 +62,7 @@ jobs:
# `-extldflags=-static` - means static link everything,
# `-tags netgo,osusergo` means use pure go replacements for "os/user" and "net"
# `-s -w` strips the binary to produce smaller size binaries
go build -v -ldflags="-s -w -extldflags=-static" -tags netgo,osusergo -o ./bin/ . ./cmd/...
go build -v -ldflags="-s -w -extldflags=-static" -tags netgo,osusergo -o ./bin/ ./cmd/...
archive="bin/karlsend-${{ github.event.release.tag_name }}-linux-aarch64.zip"
asset_name="karlsend-${{ github.event.release.tag_name }}-linux-aarch64.zip"
zip -r "${archive}" ./bin/*
Expand All @@ -81,7 +81,7 @@ jobs:
# `-extldflags=-static` - means static link everything,
# `-tags netgo,osusergo` means use pure go replacements for "os/user" and "net"
# `-s -w` strips the binary to produce smaller size binaries
go build -v -ldflags="-s -w -extldflags=-static" -tags netgo,osusergo -o ./bin/ . ./cmd/...
go build -v -ldflags="-s -w -extldflags=-static" -tags netgo,osusergo -o ./bin/ ./cmd/...
archive="bin/karlsend-${{ github.event.release.tag_name }}-windows-x64.zip"
asset_name="karlsend-${{ github.event.release.tag_name }}-windows-x64.zip"
zip -r "${archive}" ./bin/*
Expand All @@ -91,7 +91,7 @@ jobs:
- name: Build on Linux for ${{ matrix.TARGET }}
if: matrix.TARGET == 'macos/x64'
run: |
go build -v -ldflags="-s -w" -o ./bin/ . ./cmd/...
go build -v -ldflags="-s -w" -o ./bin/ ./cmd/...
archive="bin/karlsend-${{ github.event.release.tag_name }}-macos-x64.zip"
asset_name="karlsend-${{ github.event.release.tag_name }}-macos-x64.zip"
zip -r "${archive}" ./bin/*
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.1
go-version: 1.24.1

- name: Test
shell: bash
Expand All @@ -61,7 +61,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.1
go-version: 1.24.1

- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 1.23.1
go-version: 1.24.1

- name: Delete the stability tests from coverage
run: rm -r stability-tests
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ _testmain.go
debug
debug.test
__debug_bin
*__debug_*

# CI
version.txt
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ and macOS `x64` as universal binary can be downloaded at: [https://github.com/ka

### Build from Source

Go 1.19 or later is required. Install Go according to the installation
Go 1.24 or later is required. Install Go according to the installation
instructions at [http://golang.org/doc/install](http://golang.org/doc/install).
Ensure Go was installed properly and is a supported version:

Expand Down
16 changes: 9 additions & 7 deletions app/appmessage/domainconverters.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,14 @@ func RPCTransactionToDomainTransaction(rpcTransaction *RPCTransaction) (*externa
}

return &externalapi.DomainTransaction{
Version: rpcTransaction.Version,
Inputs: inputs,
Outputs: outputs,
LockTime: rpcTransaction.LockTime,
SubnetworkID: *subnetworkID,
Gas: rpcTransaction.Gas,
Payload: payload,
Version: rpcTransaction.Version,
Inputs: inputs,
Outputs: outputs,
LockTime: rpcTransaction.LockTime,
SubnetworkID: *subnetworkID,
Gas: rpcTransaction.Gas,
MassCommitment: rpcTransaction.Mass,
Payload: payload,
}, nil
}

Expand Down Expand Up @@ -288,6 +289,7 @@ func DomainTransactionToRPCTransaction(transaction *externalapi.DomainTransactio
LockTime: transaction.LockTime,
SubnetworkID: subnetworkID,
Gas: transaction.Gas,
Mass: transaction.MassCommitment,
Payload: payload,
}
}
Expand Down
8 changes: 8 additions & 0 deletions app/appmessage/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ const (
CmdGetMempoolEntriesByAddressesResponseMessage
CmdGetCoinSupplyRequestMessage
CmdGetCoinSupplyResponseMessage
CmdGetFeeEstimateRequestMessage
CmdGetFeeEstimateResponseMessage
CmdSubmitTransactionReplacementRequestMessage
CmdSubmitTransactionReplacementResponseMessage
)

// ProtocolMessageCommandToString maps all MessageCommands to their string representation
Expand Down Expand Up @@ -300,6 +304,10 @@ var RPCMessageCommandToString = map[MessageCommand]string{
CmdGetMempoolEntriesByAddressesResponseMessage: "GetMempoolEntriesByAddressesResponse",
CmdGetCoinSupplyRequestMessage: "GetCoinSupplyRequest",
CmdGetCoinSupplyResponseMessage: "GetCoinSupplyResponse",
CmdGetFeeEstimateRequestMessage: "GetFeeEstimateRequest",
CmdGetFeeEstimateResponseMessage: "GetFeeEstimateResponse",
CmdSubmitTransactionReplacementRequestMessage: "SubmitTransactionReplacementRequest",
CmdSubmitTransactionReplacementResponseMessage: "SubmitTransactionReplacementResponse",
}

// Message is an interface that describes a karlsen message. A type that
Expand Down
47 changes: 47 additions & 0 deletions app/appmessage/rpc_fee_estimate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package appmessage

// GetFeeEstimateRequestMessage is an appmessage corresponding to
// its respective RPC message
type GetFeeEstimateRequestMessage struct {
baseMessage
}

// Command returns the protocol command string for the message
func (msg *GetFeeEstimateRequestMessage) Command() MessageCommand {
return CmdGetFeeEstimateRequestMessage
}

// NewGetFeeEstimateRequestMessage returns a instance of the message
func NewGetFeeEstimateRequestMessage() *GetFeeEstimateRequestMessage {
return &GetFeeEstimateRequestMessage{}
}

type RPCFeeRateBucket struct {
Feerate float64
EstimatedSeconds float64
}

type RPCFeeEstimate struct {
PriorityBucket RPCFeeRateBucket
NormalBuckets []RPCFeeRateBucket
LowBuckets []RPCFeeRateBucket
}

// GetCoinSupplyResponseMessage is an appmessage corresponding to
// its respective RPC message
type GetFeeEstimateResponseMessage struct {
baseMessage
Estimate RPCFeeEstimate

Error *RPCError
}

// Command returns the protocol command string for the message
func (msg *GetFeeEstimateResponseMessage) Command() MessageCommand {
return CmdGetFeeEstimateResponseMessage
}

// NewGetFeeEstimateResponseMessage returns a instance of the message
func NewGetFeeEstimateResponseMessage() *GetFeeEstimateResponseMessage {
return &GetFeeEstimateResponseMessage{}
}
1 change: 1 addition & 0 deletions app/appmessage/rpc_submit_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ type RPCTransaction struct {
SubnetworkID string
Gas uint64
Payload string
Mass uint64
VerboseData *RPCTransactionVerboseData
}

Expand Down
42 changes: 42 additions & 0 deletions app/appmessage/rpc_submit_transaction_replacement.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package appmessage

// SubmitTransactionReplacementRequestMessage is an appmessage corresponding to
// its respective RPC message
type SubmitTransactionReplacementRequestMessage struct {
baseMessage
Transaction *RPCTransaction
}

// Command returns the protocol command string for the message
func (msg *SubmitTransactionReplacementRequestMessage) Command() MessageCommand {
return CmdSubmitTransactionReplacementRequestMessage
}

// NewSubmitTransactionReplacementRequestMessage returns a instance of the message
func NewSubmitTransactionReplacementRequestMessage(transaction *RPCTransaction) *SubmitTransactionReplacementRequestMessage {
return &SubmitTransactionReplacementRequestMessage{
Transaction: transaction,
}
}

// SubmitTransactionReplacementResponseMessage is an appmessage corresponding to
// its respective RPC message
type SubmitTransactionReplacementResponseMessage struct {
baseMessage
TransactionID string
ReplacedTransaction *RPCTransaction

Error *RPCError
}

// Command returns the protocol command string for the message
func (msg *SubmitTransactionReplacementResponseMessage) Command() MessageCommand {
return CmdSubmitTransactionReplacementResponseMessage
}

// NewSubmitTransactionReplacementResponseMessage returns a instance of the message
func NewSubmitTransactionReplacementResponseMessage(transactionID string) *SubmitTransactionReplacementResponseMessage {
return &SubmitTransactionReplacementResponseMessage{
TransactionID: transactionID,
}
}
2 changes: 1 addition & 1 deletion app/protocol/flows/v5/ping/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (flow *sendPingsFlow) start() error {
message, err := flow.incomingRoute.DequeueWithTimeout(common.DefaultTimeout)
if err != nil {
if errors.Is(err, router.ErrTimeout) {
return errors.Wrapf(flowcontext.ErrPingTimeout, err.Error())
return errors.Wrapf(flowcontext.ErrPingTimeout, "%s", err.Error())
}
return err
}
Expand Down
12 changes: 8 additions & 4 deletions app/rpc/rpccontext/verbosedata.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ func (ctx *Context) PopulateBlockWithVerboseData(block *appmessage.RPCBlock, dom
return err
}

if blockInfo.BlockStatus == externalapi.StatusInvalid {
return errors.Wrap(ErrBuildBlockVerboseDataInvalidBlock, "cannot build verbose data for "+
"invalid block")
}
// if blockInfo.BlockStatus == externalapi.StatusInvalid {
// return errors.Wrap(ErrBuildBlockVerboseDataInvalidBlock, "cannot build verbose data for "+
// "invalid block")
// }

_, childrenHashes, err := ctx.Domain.Consensus().GetBlockRelations(blockHash)
if err != nil {
Expand Down Expand Up @@ -93,6 +93,10 @@ func (ctx *Context) PopulateBlockWithVerboseData(block *appmessage.RPCBlock, dom
}
}

if len(domainBlock.Transactions) == 0 {
return nil
}

transactionIDs := make([]string, len(domainBlock.Transactions))
for i, transaction := range domainBlock.Transactions {
transactionIDs[i] = consensushashing.TransactionID(transaction).String()
Expand Down
2 changes: 1 addition & 1 deletion build_and_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ go install -v honnef.co/go/tools/cmd/staticcheck@latest
test -z "$(go fmt ./...)"

# look for style mistakes.
golint -set_exit_status ./...
# golint -set_exit_status ./...

# static analysis.
staticcheck -checks SA4006,SA4008,SA4009,SA4010,SA5003,SA1004,SA1014,SA1021,SA1023,SA1024,SA1025,SA1026,SA1027,SA1028,SA2000,SA2001,SA2003,SA4000,SA4001,SA4003,SA4004,SA4011,SA4012,SA4013,SA4014,SA4015,SA4016,SA4017,SA4018,SA4019,SA4020,SA4021,SA4022,SA4023,SA5000,SA5002,SA5004,SA5005,SA5007,SA5008,SA5009,SA5010,SA5011,SA5012,SA6001,SA6002,SA9001,SA9002,SA9003,SA9004,SA9005,SA9006,ST1019 ./...
Expand Down
2 changes: 1 addition & 1 deletion cmd/karlsenctl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Requirements

Go 1.19 or later.
Go 1.24 or later.

## Build from Source

Expand Down
2 changes: 1 addition & 1 deletion cmd/karlsenctl/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -- multistage docker build: stage #1: build stage
FROM golang:1.19-alpine AS build
FROM golang:1.24-alpine AS build

RUN mkdir -p /go/src/github.com/karlsen-network/karlsend/

Expand Down
2 changes: 1 addition & 1 deletion cmd/karlsenctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,6 @@ func prettifyResponse(response string) string {
}

func printErrorAndExit(message string) {
fmt.Fprintf(os.Stderr, fmt.Sprintf("%s\n", message))
fmt.Fprintln(os.Stderr, message)
os.Exit(1)
}
2 changes: 1 addition & 1 deletion cmd/karlsenminer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Requirements

Go 1.19 or later.
Go 1.24 or later.

## Build from Source

Expand Down
2 changes: 1 addition & 1 deletion cmd/karlsenminer/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -- multistage docker build: stage #1: build stage
FROM golang:1.19-alpine AS build
FROM golang:1.24-alpine AS build

RUN mkdir -p /go/src/github.com/karlsen-network/karlsend/

Expand Down
3 changes: 2 additions & 1 deletion cmd/karlsenwallet/broadcast.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/karlsen-network/karlsend/v2/cmd/karlsenwallet/daemon/client"
"github.com/karlsen-network/karlsend/v2/cmd/karlsenwallet/daemon/pb"
"github.com/karlsen-network/karlsend/v2/cmd/karlsenwallet/daemon/server"
"github.com/pkg/errors"
)

Expand Down Expand Up @@ -37,7 +38,7 @@ func broadcast(conf *broadcastConfig) error {
transactionsHex = strings.TrimSpace(string(transactionHexBytes))
}

transactions, err := decodeTransactionsFromHex(transactionsHex)
transactions, err := server.DecodeTransactionsFromHex(transactionsHex)
if err != nil {
return err
}
Expand Down
Loading