-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add GetMaxMatureBlockNumber func #26
Conversation
utils/util.go
Outdated
numer uint64 | ||
// Denominator. | ||
denom uint64 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace rationalNumber
with big.Rat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated: baf0fec
tipEpochRN, cellbaseMaturityRN := epochRationalNum(tipEpoch, cellbaseMaturity) | ||
if tipEpochRN.numer-cellbaseMaturityRN.numer < 0 { | ||
return true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use big.Rat
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated: baf0fec
utils/util.go
Outdated
nodeVersion := strings.Split(nodeInfo.Version, " (") | ||
versionArr := strings.Split(nodeVersion[0], ".") | ||
major, err := strconv.Atoi(versionArr[0]) | ||
minor, err := strconv.Atoi(versionArr[1]) | ||
patch, err := strconv.Atoi(versionArr[2]) | ||
return major, minor, patch, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nodeVersion := strings.Split(nodeInfo.Version, " (") | |
versionArr := strings.Split(nodeVersion[0], ".") | |
major, err := strconv.Atoi(versionArr[0]) | |
minor, err := strconv.Atoi(versionArr[1]) | |
patch, err := strconv.Atoi(versionArr[2]) | |
return major, minor, patch, nil | |
nodeVersion := strings.Split(nodeInfo.Version, " (") | |
versionArr := strings.Split(nodeVersion[0], ".") | |
major, err := strconv.Atoi(versionArr[0]) | |
minor, err := strconv.Atoi(versionArr[1]) | |
patch, err := strconv.Atoi(versionArr[2]) | |
return major, minor, patch, nil |
Put above line in a standalone function and test it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated: 02abcd5
README.md
Outdated
ScriptType: indexer.ScriptTypeLock, | ||
Filter: &indexer.CellsFilter{ | ||
BlockRange: &[2]uint64{0, maxMatureBlockNumber}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The filter is wrong, must only filter out cellbase, and cellbase not in genesis block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
// IsMature check if a cellbase live cell is mature | ||
func IsMature(cell *indexer.LiveCell, maxMatureBlockNumber uint64) bool { | ||
return cell.TxIndex > 0 || cell.BlockNumber == 0 || cell.BlockNumber <= maxMatureBlockNumber |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is cell.TxIndex
here mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as here: https://github.com/nervosnetwork/ckb-indexer/blob/master/src/service.rs#L235
means transaction index in the block.
README.md
Outdated
} | ||
if utils.IsMature(liveCell, maxMatureBlockNumber) { | ||
cells = append(cells, liveCell) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mixed use of <space>
and <tab>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated: b607158
e0b1f74
to
48474f1
Compare
48474f1
to
b607158
Compare
1a206cd
to
b607158
Compare
No description provided.