nip-13: check zero leading bits
ci/woodpecker/pr/woodpecker Pipeline was successful Details
ci/woodpecker/push/woodpecker Pipeline was successful Details

before it was only testing if the nonce commitment is high enough
but didn't verify leading zero bits.

with this change rendering checks now the leading zero bits count
of the event id.
pull/64/head
OFF0 1 year ago
parent 4a68940681
commit 8ff1d2c1d8
Signed by: offbyn
GPG Key ID: 94A2F643C51F37FA

@ -328,7 +328,12 @@ function renderFeed() {
const sortedFeeds = textNoteList
// dont render notes from the future
.filter(note => note.created_at < now)
.filter(note => !fitlerDifficulty || note.tags.some(([tag, , commitment]) => tag === 'nonce' && commitment >= fitlerDifficulty))
// if difficulty filter is configured dont render notes with too little pow
.filter(note => {
return !fitlerDifficulty || note.tags.some(([tag, , commitment]) => {
return tag === 'nonce' && commitment >= fitlerDifficulty && zeroLeadingBitsCount(note.id) >= fitlerDifficulty;
});
})
.sort(sortByCreatedAt).reverse();
sortedFeeds.forEach((evt, i) => {
if (feedDomMap[evt.id]) {

Loading…
Cancel
Save