remove from mempool on mine; TEMPORARY log math proof of fee inclusion in coinbase tx
This commit is contained in:
+57
-1
@@ -429,6 +429,22 @@ static bool MineAndAppendBlock(blockchain_t* chain,
|
||||
}
|
||||
}
|
||||
|
||||
// Print mathematical proof that fees are included in the coinbase payout for miner visibility.
|
||||
{
|
||||
uint64_t cb = 0;
|
||||
uint64_t fees = 0;
|
||||
if (Block_GetCoinbaseAndFeeTotals(block, &cb, &fees)) {
|
||||
uint64_t base = *currentReward;
|
||||
printf("Mined block proof: coinbase(%llu) == baseReward(%llu) + totalFees(%llu) => %llu == %llu + %llu\n",
|
||||
(unsigned long long)cb,
|
||||
(unsigned long long)base,
|
||||
(unsigned long long)fees,
|
||||
(unsigned long long)cb,
|
||||
(unsigned long long)base,
|
||||
(unsigned long long)fees);
|
||||
}
|
||||
}
|
||||
|
||||
// After successfully appending a block, attempt to attach any orphans.
|
||||
size_t attached = OrphanPool_AttemptAttach(chain);
|
||||
if (attached > 0) {
|
||||
@@ -832,7 +848,7 @@ int main(int argc, char* argv[]) {
|
||||
char supplyStr[80];
|
||||
Uint256ToDecimal(¤tSupply, supplyStr, sizeof(supplyStr));
|
||||
printf("Current chain has %zu blocks, total supply %s\n", Chain_Size(chain), supplyStr);
|
||||
printf("Commands: mine <x>, send <address> <amount> [fee], balance [address], connect <ipv4>, sync (requires nodes), flushchain, fullverify, blockdetail <block number>, wipechain, genaddr, exit\n");
|
||||
printf("Commands: mine <x>, send <address> <amount> [fee], txpooldetail <txhash>, balance [address], connect <ipv4>, sync (requires nodes), flushchain, fullverify, blockdetail <block number>, wipechain, genaddr, exit\n");
|
||||
|
||||
char line[1024];
|
||||
while (true) {
|
||||
@@ -1302,6 +1318,46 @@ int main(int argc, char* argv[]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (strcmp(cmd, "txpooldetail") == 0) {
|
||||
char* hashStr = strtok(NULL, " \t");
|
||||
if (!hashStr) {
|
||||
printf("usage: txpooldetail <txhash>\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
uint8_t txHash[32];
|
||||
if (!ParseHexAddress32(hashStr, txHash)) {
|
||||
printf("invalid tx hash: expected 64 hex chars\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
signed_transaction_t tx;
|
||||
if (!TxMempool_Lookup(txHash, &tx)) {
|
||||
printf("transaction not found in mempool\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
char senderHex[65];
|
||||
char recip1Hex[65];
|
||||
char recip2Hex[65];
|
||||
AddressToHexString(tx.transaction.senderAddress, senderHex);
|
||||
AddressToHexString(tx.transaction.recipientAddress1, recip1Hex);
|
||||
AddressToHexString(tx.transaction.recipientAddress2, recip2Hex);
|
||||
|
||||
uint8_t calcHash[32];
|
||||
Transaction_CalculateHash(&tx, calcHash);
|
||||
|
||||
printf("Transaction details:\n");
|
||||
printf(" TxHash: "); PrintHexBytes(calcHash, 32); printf("\n");
|
||||
printf(" Sender: %s%s\n", senderHex, Address_IsCoinbase(tx.transaction.senderAddress) ? " (coinbase)" : "");
|
||||
printf(" Recipient1: %s\n", recip1Hex);
|
||||
printf(" Recipient2: %s\n", recip2Hex);
|
||||
printf(" Amount1: %llu\n", (unsigned long long)tx.transaction.amount1);
|
||||
printf(" Amount2: %llu\n", (unsigned long long)tx.transaction.amount2);
|
||||
printf(" Fee: %llu\n", (unsigned long long)tx.transaction.fee);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (strcmp(cmd, "blockdetail") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user