Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: spectrewallet improvements and fixes #6

Merged
merged 1 commit into from
Oct 14, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ jobs:
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.23.1

- name: Update sources
if: matrix.TARGET == 'linux/aarch64' || matrix.TARGET == 'windows/x64'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ jobs:
run: powershell -command .github\workflows\SetPageFileSize.ps1

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.23.1

# Source: https://github.com/actions/cache/blob/main/examples.md#go---modules
- name: Go Cache
Expand All @@ -51,9 +51,9 @@ jobs:
name: Fast stability tests
steps:
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.21
go-version: 1.23.1

- name: Checkout
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![GitHub release](https://img.shields.io/github/v/release/spectre-project/spectred.svg)](https://github.com/spectre-project/spectred/releases)
[![GitHub license](https://img.shields.io/github/license/spectre-project/spectred.svg)](https://github.com/spectre-project/spectred/blob/main/LICENSE)
[![GitHub downloads](https://img.shields.io/github/downloads/spectre-project/spectred/total.svg)](https://github.com/spectre-project/spectred/releases)
[![Join the Spectre Discord Server](https://img.shields.io/discord/1233113243741061240.svg?label=&logo=discord&logoColor=ffffff&color=5865F2)](https://discord.com/invite/FZPYpwszcF)

**ATTENTION: THIS REPOSITORY IS ARCHIVED AND NO LONGER UPDATED. THE GO
VERSION HAS BEEN SUPERSEDED BY THE STABLE RUST VERSION OF SPECTRE. WE
Expand Down
2 changes: 1 addition & 1 deletion app/protocol/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var ErrPeerWithSameIDExists = errors.New("ready peer with the same ID already ex

type flowExecuteFunc func(peer *peerpkg.Peer)

// Flow is a a data structure that is used in order to associate a p2p flow to some route in a router.
// Flow is a data structure that is used in order to associate a p2p flow to some route in a router.
type Flow struct {
Name string
ExecuteFunc flowExecuteFunc
Expand Down
2 changes: 1 addition & 1 deletion app/protocol/flowcontext/flow_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func New(cfg *config.Config, domain domain.Domain, addressManager *addressmanage
}
}

// Close signals to all flows the the protocol manager is closed.
// Close signals to all flows the protocol manager is closed.
func (f *FlowContext) Close() {
close(f.shutdownChan)
}
Expand Down
3 changes: 2 additions & 1 deletion app/rpc/rpchandlers/submit_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ func HandleSubmitTransaction(context *rpccontext.Context, _ *router.Router, requ
}

log.Debugf("Rejected transaction %s: %s", transactionID, err)
errorMessage := &appmessage.SubmitTransactionResponseMessage{}
// Return the ID also in the case of error, so that clients can match the response to the correct transaction submit request
errorMessage := appmessage.NewSubmitTransactionResponseMessage(transactionID.String())
errorMessage.Error = appmessage.RPCErrorf("Rejected transaction %s: %s", transactionID, err)
return errorMessage, nil
}
Expand Down
12 changes: 10 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
spectred v0.3.10 - 2024-04-25
spectred v0.3.15 - 2024-09-20
=============================

* First version with RandomX for CPU mining.
* Wallet-related improvements and fixes.

spectred v0.3.14 - 2024-05-02
=============================

* First version, the famous Pi.
* CPU-only mining algorithm SpectreX
* Stealth and untraceable mining
* Builtin multi-core CPU miner
33 changes: 24 additions & 9 deletions cmd/spectrewallet/config.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
package main

import (
"os"

"github.com/pkg/errors"
"github.com/spectre-project/spectred/infrastructure/config"
"os"

"github.com/jessevdk/go-flags"
)
Expand All @@ -22,6 +21,8 @@ const (
newAddressSubCmd = "new-address"
dumpUnencryptedDataSubCmd = "dump-unencrypted-data"
startDaemonSubCmd = "start-daemon"
versionSubCmd = "version"
getDaemonVersionSubCmd = "get-daemon-version"
)

const (
Expand All @@ -30,11 +31,12 @@ const (
)

type configFlags struct {
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
config.NetworkFlags
}

type createConfig struct {
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\spectrewallet\\key.json (Windows))"`
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\Spectrewallet\\key.json (Windows))"`
Password string `long:"password" short:"p" description:"Wallet password"`
Yes bool `long:"yes" short:"y" description:"Assume \"yes\" to all questions"`
MinimumSignatures uint32 `long:"min-signatures" short:"m" description:"Minimum required signatures" default:"1"`
Expand All @@ -52,13 +54,13 @@ type balanceConfig struct {
}

type sendConfig struct {
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\spectrewallet\\key.json (Windows))"`
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\Spectrewallet\\key.json (Windows))"`
Password string `long:"password" short:"p" description:"Wallet password"`
DaemonAddress string `long:"daemonaddress" short:"d" description:"Wallet daemon server to connect to"`
ToAddress string `long:"to-address" short:"t" description:"The public address to send Spectre to" required:"true"`
FromAddresses []string `long:"from-address" short:"a" description:"Specific public address to send Spectre from. Use multiple times to accept several addresses" required:"false"`
FromAddresses []string `long:"from-address" short:"a" description:"Specific public address to send Spectre from. Repeat multiple times (adding -a before each) to accept several addresses" required:"false"`
SendAmount string `long:"send-amount" short:"v" description:"An amount to send in Spectre (e.g. 1234.12345678)"`
IsSendAll bool `long:"send-all" description:"Send all the Spectre in the wallet (mutually exclusive with --send-amount)"`
IsSendAll bool `long:"send-all" description:"Send all the Spectre in the wallet (mutually exclusive with --send-amount). If --from-address was used, will send all only from the specified addresses."`
UseExistingChangeAddress bool `long:"use-existing-change-address" short:"u" description:"Will use an existing change address (in case no change address was ever used, it will use a new one)"`
Verbose bool `long:"show-serialized" short:"s" description:"Show a list of hex encoded sent transactions"`
config.NetworkFlags
Expand All @@ -81,7 +83,7 @@ type createUnsignedTransactionConfig struct {
}

type signConfig struct {
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\spectrewallet\\key.json (Windows))"`
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\Spectrewallet\\key.json (Windows))"`
Password string `long:"password" short:"p" description:"Wallet password"`
Transaction string `long:"transaction" short:"t" description:"The unsigned transaction(s) to sign on (encoded in hex)"`
TransactionFile string `long:"transaction-file" short:"F" description:"The file containing the unsigned transaction(s) to sign on (encoded in hex)"`
Expand Down Expand Up @@ -113,7 +115,7 @@ type newAddressConfig struct {
}

type startDaemonConfig struct {
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\spectrewallet\\key.json (Windows))"`
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\Spectrewallet\\key.json (Windows))"`
Password string `long:"password" short:"p" description:"Wallet password"`
RPCServer string `long:"rpcserver" short:"s" description:"RPC server to connect to"`
Listen string `long:"listen" short:"l" description:"Address to listen on (default: 0.0.0.0:8882)"`
Expand All @@ -123,12 +125,19 @@ type startDaemonConfig struct {
}

type dumpUnencryptedDataConfig struct {
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\spectrewallet\\key.json (Windows))"`
KeysFile string `long:"keys-file" short:"f" description:"Keys file location (default: ~/.spectrewallet/keys.json (*nix), %USERPROFILE%\\AppData\\Local\\Spectrewallet\\key.json (Windows))"`
Password string `long:"password" short:"p" description:"Wallet password"`
Yes bool `long:"yes" short:"y" description:"Assume \"yes\" to all questions"`
config.NetworkFlags
}

type versionConfig struct {
}

type getDaemonVersionConfig struct {
DaemonAddress string `long:"daemonaddress" short:"d" description:"Wallet daemon server to connect to"`
}

func parseCommandLine() (subCommand string, config interface{}) {
cfg := &configFlags{}
parser := flags.NewParser(cfg, flags.PrintErrors|flags.HelpFlag)
Expand Down Expand Up @@ -185,6 +194,9 @@ func parseCommandLine() (subCommand string, config interface{}) {
Listen: defaultListen,
}
parser.AddCommand(startDaemonSubCmd, "Start the wallet daemon", "Start the wallet daemon", startDaemonConf)
parser.AddCommand(versionSubCmd, "Get the wallet version", "Get the wallet version", &versionConfig{})
getDaemonVersionConf := &getDaemonVersionConfig{DaemonAddress: defaultListen}
parser.AddCommand(getDaemonVersionSubCmd, "Get the wallet daemon version", "Get the wallet daemon version", getDaemonVersionConf)

_, err := parser.Parse()
if err != nil {
Expand Down Expand Up @@ -290,6 +302,9 @@ func parseCommandLine() (subCommand string, config interface{}) {
printErrorAndExit(err)
}
config = startDaemonConf
case versionSubCmd:
case getDaemonVersionSubCmd:
config = getDaemonVersionConf
}

return parser.Command.Active.Name, config
Expand Down
Loading
Loading