Add SV2 DATUM payout hardening

This commit is contained in:
Ben
2026-06-12 23:54:50 -04:00
parent bcd6bb0aa7
commit a33c530268
59 changed files with 7852 additions and 81 deletions
+6 -3
View File
@@ -8,9 +8,10 @@ import { IMiningNotify } from './stratum-messages/IMiningNotify';
import { TOTAL_EXTRANONCE_SIZE_BYTES } from './stratum.constants';
interface AddressObject {
export interface AddressObject {
address: string;
percent: number;
percent?: number;
amountSats?: number;
}
export class MiningJob {
@@ -177,7 +178,9 @@ export class MiningJob {
let rewardBalance = reward;
addresses.forEach(recipientAddress => {
const amount = Math.floor((recipientAddress.percent / 100) * reward);
const amount = recipientAddress.amountSats == null
? Math.floor(((recipientAddress.percent ?? 0) / 100) * reward)
: recipientAddress.amountSats;
rewardBalance -= amount;
coinbaseTransaction.addOutput(this.getPaymentScript(recipientAddress.address), amount);
})