|
@ -1,7 +1,7 @@ |
|
|
package com.xsn.explorer.services.logic |
|
|
package com.xsn.explorer.services.logic |
|
|
|
|
|
|
|
|
import com.alexitc.playsonify.core.ApplicationResult |
|
|
import com.alexitc.playsonify.core.ApplicationResult |
|
|
import com.xsn.explorer.errors.{BlockNotFoundError, BlockhashFormatError} |
|
|
import com.xsn.explorer.errors.{BlockNotFoundError, BlockhashFormatError, TransactionNotFoundError} |
|
|
import com.xsn.explorer.models._ |
|
|
import com.xsn.explorer.models._ |
|
|
import com.xsn.explorer.models.rpc.{Block, Transaction} |
|
|
import com.xsn.explorer.models.rpc.{Block, Transaction} |
|
|
import com.xsn.explorer.models.values.{Address, Blockhash, TransactionId} |
|
|
import com.xsn.explorer.models.values.{Address, Blockhash, TransactionId} |
|
@ -20,6 +20,12 @@ class BlockLogic { |
|
|
Or.from(maybe, One(BlockNotFoundError)) |
|
|
Or.from(maybe, One(BlockNotFoundError)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def getCoinbase(block: Block): ApplicationResult[TransactionId] = { |
|
|
|
|
|
val maybe = block.transactions.headOption |
|
|
|
|
|
|
|
|
|
|
|
Or.from(maybe, One(TransactionNotFoundError)) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Get the coinstake transaction id for the given block. |
|
|
* Get the coinstake transaction id for the given block. |
|
|
* |
|
|
* |
|
@ -144,4 +150,10 @@ class BlockLogic { |
|
|
|
|
|
|
|
|
Good(TPoSBlockRewards(ownerReward, merchantReward, masternodeRewardMaybe)) |
|
|
Good(TPoSBlockRewards(ownerReward, merchantReward, masternodeRewardMaybe)) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
def isPoS(block: rpc.Block, coinbase: rpc.Transaction): Boolean = { |
|
|
|
|
|
block.nonce == 0 && |
|
|
|
|
|
coinbase.vin.isEmpty && |
|
|
|
|
|
coinbase.vout.flatMap(_.address).isEmpty |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|