diff --git a/src/app/units/Blockchain.ts b/src/app/units/Blockchain.ts index 0e81831..9252ce7 100644 --- a/src/app/units/Blockchain.ts +++ b/src/app/units/Blockchain.ts @@ -224,6 +224,7 @@ export class Blockchain extends Unit { */ public async getPeerSubmit(peer: Peer): Promise { try { + this.logging.verbose(`Making request to: ${peer.host}api/v1/chain/submit`) const result = await fetch(`${peer.host}api/v1/chain/submit`).then(res => res.json()) const blocks: unknown = result.data?.data?.records if ( Array.isArray(blocks) && blocks.every(block => { @@ -319,11 +320,16 @@ export class Blockchain extends Unit { this.logging.debug('Called refresh().') const peers = this.getPeers() + this.logging.debug({peers}) + let longestChain: Block[] = [] const chains = await Promise.all( peers.map(peer => this.getPeerSubmit(peer)) ) + this.logging.debug('Got peer chain info:') + this.logging.debug(chains) + for ( const chain of chains ) { if ( chain @@ -331,6 +337,8 @@ export class Blockchain extends Unit { && await this.validate(chain) ) { longestChain = chain + } else { + this.logging.debug('Failed validation!') } }