mirror of
				https://github.com/hackku21/loc-chain-backend.git
				synced 2025-06-13 12:53:59 +00:00 
			
		
		
		
	Merge branch 'main' of github.com:hackku21/loc-chain-backend into main
This commit is contained in:
		
						commit
						4d687efa76
					
				@ -381,13 +381,10 @@ export class Blockchain extends Unit {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public async writeback() {
 | 
					    public async writeback() {
 | 
				
			||||||
        if ( this.breakForExit ) return;
 | 
					        if ( this.breakForExit ) return;
 | 
				
			||||||
        this.logging.info('Generating initial proof-of-elapsed-time. This will take a second...')
 | 
					 | 
				
			||||||
        this.nextWaitTime = this.random(this.MIN_WAIT_TIME, this.MAX_WAIT_TIME)
 | 
					        this.nextWaitTime = this.random(this.MIN_WAIT_TIME, this.MAX_WAIT_TIME)
 | 
				
			||||||
        this.lastBlock = this.getLastBlock()
 | 
					        this.lastBlock = this.getLastBlock()
 | 
				
			||||||
        this.nextProof = await this.generateProofOfWork(this.lastBlock, this.nextWaitTime)
 | 
					        this.nextProof = await this.generateProofOfWork(this.lastBlock, this.nextWaitTime)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        console.log('writeback approved chain', this.approvedChain)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        await Promise.all([
 | 
					        await Promise.all([
 | 
				
			||||||
            this.firebase.ref('block').set(this.approvedChain.map(x => x.toItem())),
 | 
					            this.firebase.ref('block').set(this.approvedChain.map(x => x.toItem())),
 | 
				
			||||||
            this.firebase.ref('peers').set(this.peers)
 | 
					            this.firebase.ref('peers').set(this.peers)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user