fix basecoin masking

pull/541/head
sidhujag 2020-05-06 13:48:51 -07:00
parent ee0b1d97f8
commit 98dcefc504
5 changed files with 14 additions and 14 deletions

View File

@ -323,7 +323,7 @@ func (p *BaseParser) IsAssetActivateTx(nVersion int32) bool {
return false
}
func (p *BaseParser) GetAssetsMaskFromVersion(nVersion int32) AssetsMask {
return AllMask
return BaseCoinMask
}
func (p *BaseParser) GetAssetTypeFromVersion(nVersion int32) TokenType {
return SPTUnknownType

View File

@ -437,17 +437,17 @@ const SPTAssetAllocationBurnToSyscoinType TokenType = "SPTAssetAllocationBurnToS
const SPTAssetAllocationBurnToEthereumType TokenType = "SPTAssetAllocationBurnToEthereum"
const AllMask AssetsMask = 1
const BaseCoinMask AssetsMask = 2
const AssetAllocationSendMask AssetsMask = 4
const AssetSyscoinBurnToAllocationMask AssetsMask = 8
const AssetAllocationBurnToSyscoinMask AssetsMask = 16
const AssetAllocationBurnToEthereumMask AssetsMask = 32
const AssetAllocationMintMask AssetsMask = 64
const AssetUpdateMask AssetsMask = 128
const AssetSendMask AssetsMask = 256
const AssetActivateMask AssetsMask = 512
const BaseCoinMask AssetsMask = 1
const AssetAllocationSendMask AssetsMask = 2
const AssetSyscoinBurnToAllocationMask AssetsMask = 4
const AssetAllocationBurnToSyscoinMask AssetsMask = 8
const AssetAllocationBurnToEthereumMask AssetsMask = 16
const AssetAllocationMintMask AssetsMask = 32
const AssetUpdateMask AssetsMask = 64
const AssetSendMask AssetsMask = 128
const AssetActivateMask AssetsMask = 256
const AssetMask AssetsMask = AssetActivateMask | AssetUpdateMask | AssetSendMask | AssetSyscoinBurnToAllocationMask | AssetAllocationBurnToSyscoinMask | AssetAllocationBurnToEthereumMask | AssetAllocationMintMask | AssetAllocationSendMask
const AllMask AssetsMask = BaseCoinMask | AssetMask
// Amount is datatype holding amounts
type Amount big.Int
// MarshalJSON Amount serialization

View File

@ -143,7 +143,7 @@ func (d *RocksDB) addToAddressesAndContractsEthereumType(addrDesc bchain.Address
}
}
}
counted := addToAddressesMap(addresses, strAddrDesc, btxID, index, bchain.AllMask)
counted := addToAddressesMap(addresses, strAddrDesc, btxID, index, bchain.BaseCoinMask)
if !counted {
ac.TotalTxs++
}

View File

@ -407,7 +407,7 @@ func (d *RocksDB) GetTxAssets(assetGuid uint32, lower uint32, higher uint32, ass
txids := []string{}
for _, txIndex := range txIndexes {
mask := uint32(txIndex.Type)
if (assetsBitMask == bchain.AllMask || (uint32(assetsBitMask) & mask) == mask) {
if (uint32(assetsBitMask) & mask) == mask {
txids = append(txids, hex.EncodeToString(txIndex.BtxID))
}
}

View File

@ -112,7 +112,7 @@ func addressKeyHex(a string, height uint32, d *RocksDB) string {
func txIndexesHex(tx string, indexes []int32, d *RocksDB) string {
buf := make([]byte, vlq.MaxLen32)
// type
l := d.chainParser.PackVaruint(uint(bchain.AllMask), buf)
l := d.chainParser.PackVaruint(uint(bchain.BaseCoinMask), buf)
tx = hex.EncodeToString(buf[:l]) + tx
for i, index := range indexes {
index <<= 1