Skip to content

[Fix / Upgrade] PoS Staking tx inclusion, watchonly upgrades, new stealthkey rpc#1053

Open
blondfrogs wants to merge 5 commits intoVeil-Project:masterfrom
blondfrogs:watchonlyaddressremovefix
Open

[Fix / Upgrade] PoS Staking tx inclusion, watchonly upgrades, new stealthkey rpc#1053
blondfrogs wants to merge 5 commits intoVeil-Project:masterfrom
blondfrogs:watchonlyaddressremovefix

Conversation

@blondfrogs
Copy link
Collaborator

@blondfrogs blondfrogs commented Jan 9, 2026

This PR contains several fixes and improvements for watch-only address handling, stealth key management, and a critical PoS block creation bug.

Bug Fixes

Fix PoS blocks dropping first mempool transaction (7e90fcf)

  • PoS blocks were silently dropping the first transaction from the mempool
  • The coinstake transaction was overwriting position 1 in the block's transaction list, where addPackageTxs() had already placed a mempool transaction
  • Added a dummy coinstake placeholder to reserve position 1 before mempool transactions are added
  • This ensures all pending transactions are properly included in PoS blocks

Fix watchonly status showing 0 transactions (1c4c634)

  • getwatchonlystatus was reporting 0 transactions even when transactions existed
  • Legacy bug caused first transaction to be stored at index 0 with count also stored as 0
  • Added check to detect transactions at index 0 when count is 0

Fix watchonly status and indexing (af9de02)

  • Fixed sync status check to compare against heightWhenImported instead of scanFromHeight
  • Added progress information (scanned height, scan from height, imported height, percent complete)
  • Fixed getwatchonlytxes indexing to use proper 0-based user-facing API with 1-based database indexing
  • Added input validation for starting_index parameter

New Features

Import stealth keys RPC and dump improvements (49affbf)

  • Added importstealthkeys RPC to import stealth addresses with full private keys (scan + spend secrets)
  • Added stealth key support to dumpwallet RPC - now exports stealth address private keys
  • Fixed metadata saving - ephemeral pubkeys are now always saved (needed to regenerate keys later)
  • Fixed several instances of RegenerateKey to use GetKey for proper key retrieval

Remove watchonly address improvements (c43a625)

  • Enhanced removewatchonlyaddress to accept stealth address string directly (in addition to scan_secret + spend_public)
  • Now properly removes all associated transaction data from the database
  • Returns count of transactions removed
  • Added database method EraseWatchOnlyAddress for complete cleanup

@ohcee
Copy link
Collaborator

ohcee commented Jan 10, 2026

utACK

@blondfrogs blondfrogs force-pushed the watchonlyaddressremovefix branch from 85c58cb to 49affbf Compare January 19, 2026 23:37
@blondfrogs blondfrogs changed the title [Bug Fix] Ability to remove watchonly addresses fully [Fix / Upgrade] PoS Staking tx inclusion, watchonly upgrades, new stealthkey rpc Jan 26, 2026
Copy link
Collaborator

@seanPhill seanPhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate this bug fix (c43a625 "remove watchonly address fixes") and will be testing it on testnet pronto.
utACK

Copy link
Collaborator

@seanPhill seanPhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK af9de02 "watchonly status and indexing"

Copy link
Collaborator

@seanPhill seanPhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK ( 49affbf "importstealth rpc, stealthkey support in dump rpc, metadata saved")
Love your code quality and documentation!

Copy link
Collaborator

@seanPhill seanPhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK ( 7e90fcf "Fix PoS blocks dropping first mempool transaction" )
This is a great catch! I had not realised why I often had to push through transactions on testnet with a proof of work block. On mainnet it wasn't a huge problem, as there were always proof of work blocks. Testing this on testnet shortly.

In fact it wasn't extremely obvious as just looking at my spreadsheet of the superblock transactions, they've been confirmed in staked blocks slightly more than 50% of the time, and I haven't analysed this on other transactions such as budgets or my own many spends, statistically, so I hardly ever noticed it on mainnet, just when spending testnet funds, or noticed the wait occasionally when broadcasting a budget spend, and didn't attribute it to anything like this.

Copy link
Collaborator

@seanPhill seanPhill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK ( 1c4c634 "Fix watchonly status showing 0 transactions" )
💯

@Veil-Project
Copy link
Owner

Very much appreciated. Will merge this as soon as testnet testing has been done.

@ohcee
Copy link
Collaborator

ohcee commented Jan 27, 2026

Thanks for the awesome work @blondfrogs.

@seanPhill
Copy link
Collaborator

I should remind people that Ubuntu 24.04 or later is needed for this. I went out of my way on a previous build to support an old Ubuntu, but I won't this time.

Those with old Ubuntu will get a message like this:

./veild: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by ./veild)
./veild: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by ./veild)
./veild: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./veild)
./veild: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by ./veild)
./veild: /lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by ./veild)
./veild: /lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.13' not found (required by ./veild)

It's best to just upgrade the host, from 20.04 LTS in the case I just tried.

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal

@seanPhill
Copy link
Collaborator

seanPhill commented Jan 28, 2026

@blondfrogs On an Ubuntu server upgraded from 20.04 to 24.04 LTS I have a couple of testnet wallets, both with bloated 100-200 MB-ish wallet.dats. The one getting IPv4 peers is with the standard / automatic testnet settings, and the one set on IPv6 has a custom RPC port, username and password, and that all worked fine, and maybe this server is a bit undersized than some of my others, but they start and sync fine, but they are stopping after being unlocked, with the last line in the debug log being UnlockZerocoinWallet: cwallet set zerocoin masterseed to …
Any idea of what is going wrong?

$ ./veild -testnet
Segmentation fault (core dumped)

Restarting the released version 1.4.1.0.
Unlocked. Didn't crash. getwalletinfo … still running.

Second instance also running fine (on the released version), unlike the PR version.

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

Successfully merging this pull request may close these issues.

4 participants