Exchance transaction for set() in Blockchain

This commit is contained in:
Garrett Mills 2021-04-10 16:07:23 -05:00
parent 0a512170cc
commit d07feccd14
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -330,7 +330,18 @@ export class Blockchain extends Unit {
this.pendingTransactions = []
await (<BlockResource>this.app().make(BlockResource)).push(block)
} else {
await this.firebase.ref('block').transaction((_) => {
await this.firebase.ref('block').set((time_x_blocks[min] || []).map(x => {
const item = x.toItem()
// @ts-ignore
delete item.firebaseID
if ( !item.transactions ) {
item.transactions = []
}
return item
}))
/*await this.firebase.ref('block').transaction((_) => {
return (time_x_blocks[min] || []).map(x => {
const item = x.toItem()
// @ts-ignore
@ -342,7 +353,7 @@ export class Blockchain extends Unit {
return item
})
})
})*/
this.pendingSubmit = undefined
await this.attemptSubmit()