BIP147 minor error

BIP147 minor error
2016-03-22  6:48 ` jl2012
  
From: Sergio Demian Lerner @ 2016-03-21  2:50 UTC (permalink / raw)
  To: bitcoin-dev

[-- Attachment #1: Type: text/plain, Size: 471 bytes --]

The BIP147 reads:

*Sigop cost* is defined. The cost of a sigop in traditional script is 4,
while the cost of a sigop in witness program is 1.

The new rule is total *sigop cost* ≤ 80,000.

But the code implements:
if (nSigOps + (nWitSigOps + 3) / 4 > MAX_BLOCK_SIGOPS)
 ... error....

Which is not the same.

For example:
nSigOps = 1
nWitSigOps =79999

Is not an error by BIP definition but it's an error by the implemented code.

Regards, Sergio.

[-- Attachment #2: Type: text/html, Size: 625 bytes --]

 permalink raw reply	[|nested]
2016-03-21  2:50 [bitcoin-dev] BIP147 minor error Sergio Demian Lerner

  2016-03-22 10:39   ` Sergio Demian Lerner
  
From: jl2012 @ 2016-03-22  6:48 UTC (permalink / raw)
  To: 'Sergio Demian Lerner';  bitcoin-dev

[-- Attachment #1: Type: text/plain, Size: 889 bytes --]

Do you mean BIP141?

 

Your example is an error by BIP141:

 

1*4 + 79999*1 = 80003 > 80000

 

From: bitcoin-dev-bounces@lists•linuxfoundation.org [mailto:bitcoin-dev-bounces@lists•linuxfoundation.org] On Behalf Of Sergio Demian Lerner via bitcoin-dev
Sent: Monday, 21 March, 2016 10:51
To: bitcoin-dev <bitcoin-dev@lists•linuxfoundation.org>
Subject: [bitcoin-dev] BIP147 minor error

 

The BIP147 reads:

Sigop cost is defined. The cost of a sigop in traditional script is 4, while the cost of a sigop in witness program is 1. 

The new rule is total sigop cost ≤ 80,000. 

But the code implements:

if (nSigOps + (nWitSigOps + 3) / 4 > MAX_BLOCK_SIGOPS)

 ... error....

Which is not the same.


For example:

nSigOps = 1
nWitSigOps =79999

Is not an error by BIP definition but it's an error by the implemented code.

Regards, Sergio.


[-- Attachment #2: Type: text/html, Size: 4354 bytes --]

 permalink raw reply	[|nested]
2016-03-22  6:48 ` jl2012

  
From: Sergio Demian Lerner @ 2016-03-22 10:39 UTC (permalink / raw)
  To: jl2012;  bitcoin-dev

[-- Attachment #1: Type: text/plain, Size: 1040 bytes --]

My mistake.
El mar 22, 2016 3:49 AM, <jl2012@xbt•hk> escribió:

> Do you mean BIP141?
>
>
>
> Your example is an error by BIP141:
>
>
>
> 1*4 + 79999*1 = 80003 > 80000
>
>
>
> *From:* bitcoin-dev-bounces@lists•linuxfoundation.org [mailto:
> bitcoin-dev-bounces@lists•linuxfoundation.org] *On Behalf Of *Sergio
> Demian Lerner via bitcoin-dev
> *Sent:* Monday, 21 March, 2016 10:51
> *To:* bitcoin-dev <bitcoin-dev@lists•linuxfoundation.org>
> *Subject:* [bitcoin-dev] BIP147 minor error
>
>
>
> The BIP147 reads:
>
> *Sigop cost* is defined. The cost of a sigop in traditional script is 4,
> while the cost of a sigop in witness program is 1.
>
> The new rule is total *sigop cost* ≤ 80,000.
>
> But the code implements:
>
> if (nSigOps + (nWitSigOps + 3) / 4 > MAX_BLOCK_SIGOPS)
>
>  ... error....
>
> Which is not the same.
>
>
> For example:
>
> nSigOps = 1
> nWitSigOps =79999
>
> Is not an error by BIP definition but it's an error by the implemented
> code.
>
> Regards, Sergio.
>

[-- Attachment #2: Type: text/html, Size: 2959 bytes --]

 permalink raw reply	[|nested]