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

skycoin-cli walletAddAddresses nil pointer dereference error with xpub type wallet #2691

Open
0pcom opened this issue Sep 20, 2022 · 0 comments

Comments

@0pcom
Copy link
Collaborator

0pcom commented Sep 20, 2022

skycoin-cli walletCreate ~/.skycoin/test01.wlt -t bip44
{
    "meta": {
        "bip44Coin": "8000",
        "coin": "skycoin",
        "cryptoType": "",
        "encrypted": "false",
        "filename": "test01.wlt",
        "label": "",
        "lastSeed": "",
        "secrets": "",
        "seed": "ten sheriff rule shaft swear lesson capital maximum return lava shrimp develop",
        "seedPassphrase": "",
        "tm": "1663678058",
        "type": "bip44",
        "version": "0.4",
        "xpub": ""
    },
    "entries": [
        {
            "address": "28WYopt34foa3W1TZwgALAPETr2NM2MAeGU",
            "public_key": "039fe6725e26c44cf750d6447042f4447a5e3773baf9e412514f9a07c540f70830",
            "secret_key": "66b0f2e1df808ae3ab524c6b2e5c2d1f5d2c656bd7477e701e5b2e0a1b4f232f",
            "child_number": 0,
            "change": 0
        }
    ]
}


$ skycoin-cli walletKeyExport .skycoin/test01.wlt -k xpub -p "0/0"
xpub6F9EPgfMyytq7oGZrAjDoaAk4T9N2C59Ak272UM8BWracJQaAMJKDotvQAi9o4xKsuj7Us77koFvHFs22CtfN9sngZAzhTzMuNufDzXqK7m


$ skycoin-cli walletCreate ~/.skycoin/xpubtest01.wlt -t xpub --xpub xpub6F9EPgfMyytq7oGZrAjDoaAk4T9N2C59Ak272UM8BWracJQaAMJKDotvQAi9o4xKsuj7Us77koFvHFs22CtfN9sngZAzhTzMuNufDzXqK7m
{
    "meta": {
        "coin": "skycoin",
        "cryptoType": "",
        "encrypted": "false",
        "filename": "xpubtest01.wlt",
        "label": "",
        "lastSeed": "",
        "secrets": "",
        "seed": "",
        "seedPassphrase": "",
        "tm": "1663678131",
        "type": "xpub",
        "version": "0.4",
        "xpub": "xpub6F9EPgfMyytq7oGZrAjDoaAk4T9N2C59Ak272UM8BWracJQaAMJKDotvQAi9o4xKsuj7Us77koFvHFs22CtfN9sngZAzhTzMuNufDzXqK7m"
    },
    "entries": [
        {
            "address": "28WYopt34foa3W1TZwgALAPETr2NM2MAeGU",
            "public_key": "039fe6725e26c44cf750d6447042f4447a5e3773baf9e412514f9a07c540f70830",
            "secret_key": "",
            "child_number": 0
        }
    ]
}


$ skycoin-cli walletAddAddresses ~/.skycoin/xpubtest01.wlt -n 2
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x6102a6]

goroutine 1 [running]:
github.com/skycoin/skycoin/src/cipher/bip32.(*PublicKey).NewPublicChildKey(0x7f8bccc57500?, 0x139580?)
	github.com/skycoin/skycoin/src/cipher/bip32/bip32.go:355 +0x26
github.com/skycoin/skycoin/src/wallet.(*XPubWallet).generateEntries(0xc0002f8750, 0x2, 0x1)
	github.com/skycoin/skycoin/src/wallet/xpub_wallet.go:175 +0x1cf
github.com/skycoin/skycoin/src/wallet.(*XPubWallet).GenerateAddresses(0xc0002f8750, 0x5?)
	github.com/skycoin/skycoin/src/wallet/xpub_wallet.go:219 +0x54
github.com/skycoin/skycoin/src/cli.GenerateAddressesInFile.func1({0xb05d90?, 0xc0002f8750?}, 0xc0002ef5e0?)
	github.com/skycoin/skycoin/src/cli/generate_addrs.go:111 +0x2a
github.com/skycoin/skycoin/src/cli.GenerateAddressesInFile({0x7ffc187c0a00, 0x22}, 0x0?, {0xafad00, 0xf5d090})
	github.com/skycoin/skycoin/src/cli/generate_addrs.go:134 +0x1a9
github.com/skycoin/skycoin/src/cli.generateAddrs(0xc0002f2c80?, {0xc0002f8240, 0x1, 0x3?})
	github.com/skycoin/skycoin/src/cli/generate_addrs.go:63 +0x135
github.com/spf13/cobra.(*Command).execute(0xc0002f2c80, {0xc0002f8210, 0x3, 0x3})
	github.com/spf13/cobra@v1.5.0/command.go:872 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002ec000)
	github.com/spf13/cobra@v1.5.0/command.go:990 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.5.0/command.go:918
main.main()
	github.com/skycoin/skycoin/cmd/skycoin-cli/skycoin-cli.go:31 +0x16f

the help text clearly suggests that other wallet types are supported

$ skycoin-cli walletAddAddresses --help
USAGE:
  skycoin-cli walletAddAddresses [wallet] [flags]

DESCRIPTION:
    Generate additional addresses for a deterministic, bip44 or xpub wallet.
    Addresses are generated according to the wallet type's generation mechanism.

    Warning: if you generate long (over 20) sequences of empty addresses and use
    a later address this can cause the wallet history scanner to miss your addresses,
    if you load the wallet from seed elsewhere. In that case, you'll have to manually
    generate addresses to cover the gap of unused addresses in the sequence.

    BIP44 wallets generate their addresses on the external (0'/0) chain.

    Use caution when using the "-p" command. If you have command
    history enabled your wallet encryption password can be recovered from the
    history log. If you do not include the "-p" option you will be prompted to
    enter your password after you enter your command.

FLAGS:
  -h, --help              help for walletAddAddresses
  -j, --json              Returns the results in JSON format
  -n, --num uint          Number of addresses to generate (default 1)
  -p, --password string   wallet password

ENVIRONMENT VARIABLES:
    RPC_ADDR: Address of RPC node. Must be in scheme://host format. Default "http://127.0.0.1:6420"
    RPC_USER: Username for RPC API, if enabled in the RPC.
    RPC_PASS: Password for RPC API, if enabled in the RPC.
    COIN: Name of the coin. Default "skycoin"
    DATA_DIR: Directory where everything is stored. Default "$HOME/.$COIN/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant