Skip to content

Commit

Permalink
more tx-broadcaster script cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zone117x committed Mar 14, 2024
1 parent 3564463 commit d7dcd08
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ services:
STACKS_CORE_RPC_HOST: stacks-node
STACKS_CORE_RPC_PORT: 20443
NAKAMOTO_BLOCK_INTERVAL: *NAKAMOTO_BLOCK_INTERVAL
STACKS_30_HEIGHT: *STACKS_30_HEIGHT
ACCOUNT_KEYS: 0d2f965b472a82efd5a96e6513c8b9f7edc725d5c96c7d35d6c722cedeb80d1b01,975b251dd7809469ef0c26ec3917971b75c51cd73a022024df4bf3b232cc2dc001,c71700b07d520a8c9731e4d0f095aa6efb91e16e25fb27ce2b72e7b698f8127a01
depends_on:
- stacks-node
Expand Down
7 changes: 4 additions & 3 deletions stacking/tx-broadcaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
const broadcastInterval = parseInt(process.env.NAKAMOTO_BLOCK_INTERVAL ?? '2');
const url = `http://${process.env.STACKS_CORE_RPC_HOST}:${process.env.STACKS_CORE_RPC_PORT}`;
const network = new StacksTestnet({ url });
const EPOCH_30_START = parseInt(process.env.STACKS_30_HEIGHT ?? '0');

const accounts = process.env.ACCOUNT_KEYS!.split(',').map(privKey => ({
privKey,
Expand Down Expand Up @@ -58,10 +59,10 @@ async function waitForNakamoto() {
while (true) {
try {
const poxInfo = await client.getPoxInfo();
if (!poxInfo.contract_id.endsWith('.pox-4')) {
console.log(`Pox contract is not .pox-4, waiting for pox-4 (contract=${poxInfo.contract_id}) ...`);
if (poxInfo.current_burnchain_block_height! <= EPOCH_30_START) {
console.log(`Nakamoto not activated yet, waiting... (current=${poxInfo.current_burnchain_block_height}), (epoch3=${EPOCH_30_START})`);
} else {
console.log(`Pox contract is .pox-4, ready to submit txs for Nakamoto block production`);
console.log(`Nakamoto activation height reached, ready to submit txs for Nakamoto block production`);
break;
}
} catch (error) {
Expand Down

0 comments on commit d7dcd08

Please sign in to comment.