<!-- XE-0995 · verifyBlockCredential uses unfinalized frontier keyset instead of keyset at b.Previous, and addBlock conflict staging omits BlockLeaseSettle stake refund · testnet -->
*Markdown view of <https://bounty.xe.network/XE-0995>. The page is the record; this is the same page for reading.*

XE-0995 · Bounty

# verifyBlockCredential uses unfinalized frontier keyset instead of keyset at b.Previous, and addBlock conflict staging omits BlockLeaseSettle stake refund

Patched
Medium
web
filed 2026-11-07 04:07 UTC
by Ashev Ardiansyah

Verdict
:   Likely valid

Tier
:   Medium

Claimed
:   Medium

Area
:   Consensus

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-18 08:09 UTC

Told
:   2026-11-17 16:39 UTC

### Patches

None linked.

### History

- [479818](https://bounty.xe.network/log/479818) 2026-11-18 08:09 UTC ticket.status accepted → patched
- [443601](https://bounty.xe.network/log/443601) 2026-11-17 16:39 UTC reply.sent
- [442700](https://bounty.xe.network/log/442700) 2026-11-17 16:23 UTC ticket.status triaging → accepted
- [45131](https://bounty.xe.network/log/45131) 2026-11-08 20:39 UTC reply.sent
- [45130](https://bounty.xe.network/log/45130) 2026-11-08 20:39 UTC proposal.adopted
- [45129](https://bounty.xe.network/log/45129) 2026-11-08 20:39 UTC proposal.adopted
- [45128](https://bounty.xe.network/log/45128) 2026-11-08 20:39 UTC ticket.status new → triaging
- [45127](https://bounty.xe.network/log/45127) 2026-11-08 20:39 UTC proposal.adopted
- [45126](https://bounty.xe.network/log/45126) 2026-11-08 20:39 UTC ticket.award
- [45125](https://bounty.xe.network/log/45125) 2026-11-08 20:39 UTC proposal.adopted
- [45124](https://bounty.xe.network/log/45124) 2026-11-08 20:39 UTC ticket.facts
- [45123](https://bounty.xe.network/log/45123) 2026-11-08 20:39 UTC proposal.adopted

[Full history](https://bounty.xe.network/log?ref=XE-0995) · [JSON](https://bounty.xe.network/v1/tickets/XE-0995) · [markdown](https://bounty.xe.network/XE-0995.md)

### Report

Two validation defects in `core/ledger.go` cause valid sibling blocks in conflict forks to be rejected before conflict resolution can run:

### 1\. `verifyBlockCredential` validates sibling conflicts against the unfinalized frontier keyset (`core/ledger.go:1544-1567`)

When a multisig account `M` has an unfinalized `multisig_update` block `B1` at height `h` that rotates its keyset from `K1` to `K2`, `B1` immediately mutates `l.keysets[M] = K2` on ingest (`core/ledger.go:1428`).

If a competing sibling block `B2` at the same height `h` (sharing `B2.Previous == B1.Previous`) arrives signed by the prior quorum `K1`, `addBlock` calls `l.verifyBlockCredential(B2)` at `core/ledger.go:804` **before** reaching the conflict fork detection at `core/ledger.go:819`:

```
func (l *Ledger) verifyBlockCredential(b *Block) error {
    ...
    ks := l.GetKeyset(b.Account)
    if ks != nil {
        if len(b.Signatures) == 0 {
            return fmt.Errorf("multisig account %s requires threshold signatures", b.Account[:12])
        }
        return verifyMultisig(ks, hashBytes, b.Signatures)
    }
```

Because `l.GetKeyset(b.Account)` returns the unfinalized frontier keyset `K2` installed by `B1` rather than the keyset active at `b.Previous` (`K1`), `verifyBlockCredential(B2)` fails with an unknown/insufficient signer error and drops `B2` before `registerConflict(B1, B2)` is ever reached. Thus an unfinalized `multisig_update` cannot be contested at the same height by a sibling block signed under the keyset that was actually active at `b.Previous`.

### 2\. `addBlock` conflict staging `parentBalance` inline loop omits `BlockLeaseSettle` `+lease.Stake` XUSD refund (`core/ledger.go:838-869`)

When a sibling conflict is detected at `core/ledger.go:819` (`headHash != "" && b.Previous != headHash`), `addBlock` reconstructs `parentBalance` and `parentAssetBalances` at `b.Previous` using an inline loop over `chain[:len(chain)-1]` (`core/ledger.go:838-869`) instead of calling `computeParentState` (`core/ledger.go:2408-2469`).

While `computeParentState` handles `BlockLeaseSettle` (`core/ledger.go:2447-2454`) by crediting `lease.Stake` back to `assets[AssetXUSD]`, the inline loop in `addBlock` (`core/ledger.go:840-865`) only handles `BlockSend`, `BlockReceive`, `BlockMint`, `BlockBurn`, `BlockSwap`, `BlockSlashing`, `BlockEpochRewards`, and `BlockLeaseOpen`, completely omitting `BlockLeaseSettle`, `BlockLeaseAccept`, `BlockLeaseRenew`, `BlockLeaseCancel`, and `BlockLeaseForceSettle`.

Consequently, if an account settles a lease (`BlockLeaseSettle`, receiving its `+lease.Stake` XUSD refund) and then has two conflicting blocks at the next height where the second block spends that refunded XUSD, `validateBlockStaged` checks `parentAssetBalances[AssetXUSD]` (`0` instead of `lease.Stake`) and rejects the valid sibling block with `insufficient XUSD balance: have 0, need ...`.

### Remediation

1. In `addBlock`, replace the duplicated inline `parentBalance` / `parentAssetBalances` reconstruction at `core/ledger.go:838-869` with `l.computeParentState(b.Account, chain)` (and extend `computeParentState` to include `BlockLeaseRenew`, `BlockLeaseCancel`, and `BlockLeaseForceSettle`).
2. When `b.Previous != headHash` on a multisig account, resolve the keyset effective at `b.Previous` rather than the unfinalized tip keyset.

### Thread

**Joseph Denne**team2026-11-08 20:39 UTCdesk

Thanks for the report. We have read both parts against the current tree. The first part is being handled alongside related work already in progress. The second part refers to functions that are not present in the ledger code at head, so we could not confirm it as described. We will update this ticket when there is more to say.

**XE desk**team2026-11-17 16:39 UTCdesk

Read and accepted. It is tracked internally and the fix will land in a public PR; this issue is
updated when it does, and the tier and award follow the fix. The desk entry is https://bounty.xe.network/XE-0995.
