Fix coinbase unlock: miner/protocol outputs require 60 confirmations

Salvium coinbase outputs set unlock_time=60 (bare constant), not
   height+60. WalletOutput.isUnlocked() was treating this as "unlock at
   block 60" which is always true, causing ~12 SAL overcounting vs C++
   wallet. Now checks txType for miner/protocol and applies the 60-block
   confirmation window from blockHeight.
This commit is contained in:
Matt Hess
2026-02-11 04:22:12 +00:00
parent 01e07c2222
commit 8d297db5cf
+11
View File
@@ -153,6 +153,17 @@ export class WalletOutput {
* @returns {boolean}
*/
isUnlocked(currentHeight, unlockBlocks = 10) {
// Coinbase outputs (miner/protocol) set unlock_time to the bare constant
// CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW (60), NOT height+60.
// They always require 60 confirmations regardless of the unlock_time value.
const isCoinbase = this.txType === 'miner' || this.txType === 'protocol'
|| this.txType === 1 || this.txType === 2;
if (isCoinbase) {
const MINED_MONEY_UNLOCK_WINDOW = 60;
return this.blockHeight !== null &&
(currentHeight - this.blockHeight) >= MINED_MONEY_UNLOCK_WINDOW;
}
if (this.unlockTime === 0n) {
// Standard unlock by confirmations
return this.blockHeight !== null &&