Scope block reorg detection to the current chain
Blocks are now stamped with the Bitcoin network name ("main", "test",
"signet") at ingest time. The reconcile loop's Pass 2 skips any stored
block whose chain differs from the node's current chain, preventing
testnet blocks from being falsely orphaned after switching back to
mainnet. Legacy rows with an empty chain field fall through unchanged.
The UI shows a blue "test" / "signet" badge next to blocks from a
non-current network so operators can distinguish cross-chain history
from genuine reorg-orphaned blocks.
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
const explorerBase = $derived(
|
||||
explorerBaseFor(snap.data?.chain?.chain, snap.data?.mempool_base_url),
|
||||
);
|
||||
|
||||
const currentChain = $derived(snap.data?.chain?.chain ?? "");
|
||||
</script>
|
||||
|
||||
<section class="card">
|
||||
@@ -36,6 +38,9 @@
|
||||
{#if b.orphaned_at}
|
||||
<span class="orphan-tag" title="Reorged out of the canonical chain at {b.orphaned_at}">orphaned</span>
|
||||
{/if}
|
||||
{#if b.chain && currentChain && b.chain !== currentChain}
|
||||
<span class="chain-tag" title="Mined on {b.chain} — current node is {currentChain}">{b.chain}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="hash-cell">
|
||||
{#if b.hash}
|
||||
@@ -121,6 +126,18 @@
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.chain-tag {
|
||||
display: inline-block;
|
||||
margin-left: 0.4em;
|
||||
padding: 0.05em 0.4em;
|
||||
border-radius: 3px;
|
||||
background: rgba(80, 160, 220, 0.15);
|
||||
color: rgb(100, 170, 220);
|
||||
font-size: 0.7em;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.unit {
|
||||
color: var(--fg-dim);
|
||||
font-size: 0.75em;
|
||||
|
||||
@@ -98,6 +98,9 @@ export type BlockRecord = {
|
||||
// longer matches the canonical block at this height (network reorged
|
||||
// us out). UI renders these strikethrough.
|
||||
orphaned_at?: string; // RFC 3339, omitted when zero
|
||||
// Bitcoin network the block was mined on ("main", "test", "signet").
|
||||
// Absent for legacy rows recorded before this field was added.
|
||||
chain?: string;
|
||||
};
|
||||
|
||||
export type HashratePoint = {
|
||||
|
||||
Reference in New Issue
Block a user