1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192]
helo=mx.sourceforge.net)
by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
(envelope-from <jtimon@jtimon.cc>) id 1Ypttq-0003GJ-CP
for bitcoin-development@lists.sourceforge.net;
Wed, 06 May 2015 07:37:46 +0000
Received: from mail-wi0-f177.google.com ([209.85.212.177])
by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128)
(Exim 4.76) id 1Yptto-0007FO-1l
for bitcoin-development@lists.sourceforge.net;
Wed, 06 May 2015 07:37:46 +0000
Received: by widdi4 with SMTP id di4so190702853wid.0
for <bitcoin-development@lists.sourceforge.net>;
Wed, 06 May 2015 00:37:38 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:mime-version:in-reply-to:references:date
:message-id:subject:from:to:cc:content-type
:content-transfer-encoding;
bh=fsAcHvmBIz4mb1NtfzhkcUXH+fsHYzfLPPCxlctcMjk=;
b=DZBGAKHImQ4a+9XNWLYxe+M46cJ6uVRvZjQhmxGGcfEZ4zPt6zlGcArBfg10IPfHY7
1wgXaYl9Ifw4vRI04geh/90xSY2Q6SmOFrw4oqIIWbAk1jRV/hFr4PnZiV++hAlEwlnI
KYoQFv+yCzGmV4Js3I40cwJT8MdITs+TU7xzr5QhVz21fIYCIVjMKqFk/1j6ajsfcFQM
BYcCIhwCVv34002zAXncOnkaIUWiAJP+SmqDvSF+q5uY9nQNfZkv9xHhfwdkcLMx7VJV
aSyaHFlVhAxYqblobGvtWUXoBS94mBzAC0DHZwF1KTtcItd8vedlX81bgz7CucLcgTj1
u3FA==
X-Gm-Message-State: ALoCoQlYAXTk0QEPCLCMWTNoK2HPSVCKKVNMqp/IisPpLdGZSE9bKz4/ujFomQvlioxpCAkhoxVU
MIME-Version: 1.0
X-Received: by 10.180.37.73 with SMTP id w9mr2401796wij.7.1430897857968; Wed,
06 May 2015 00:37:37 -0700 (PDT)
Received: by 10.194.124.2 with HTTP; Wed, 6 May 2015 00:37:37 -0700 (PDT)
In-Reply-To: <CAE-z3OVrHqK1gyxCimz3ATBV3ojuyBNO-Jj6bzmcxMgfWe9jkg@mail.gmail.com>
References: <20141001130826.GM28710@savin.petertodd.org>
<55075795.20904@bluematt.me>
<20150421075912.GA25282@savin.petertodd.org>
<5546D653.4070404@bluematt.me>
<CABm2gDqcD4ENex3LzKfeGqaotoO-XxLHhLzOEPwk92SaiD8snQ@mail.gmail.com>
<CAE-z3OVrHqK1gyxCimz3ATBV3ojuyBNO-Jj6bzmcxMgfWe9jkg@mail.gmail.com>
Date: Wed, 6 May 2015 09:37:37 +0200
Message-ID: <CABm2gDpp-tKPa4NtX29FhB5AN9sKcJJ9CboZoaczt2bU2h=5tQ@mail.gmail.com>
From: =?UTF-8?B?Sm9yZ2UgVGltw7Nu?= <jtimon@jtimon.cc>
To: Tier Nolan <tier.nolan@gmail.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
See http://spamassassin.org/tag/ for more details.
X-Headers-End: 1Yptto-0007FO-1l
Cc: Bitcoin Dev <bitcoin-development@lists.sourceforge.net>
Subject: Re: [Bitcoin-development] Relative CHECKLOCKTIMEVERIFY (was CLTV
proposal)
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Wed, 06 May 2015 07:37:46 -0000
On Tue, May 5, 2015 at 10:38 PM, Tier Nolan <tier.nolan@gmail.com> wrote:
> I think that should be greater than in the comparison? You want it to fa=
il
> if the the height of the UTXO plus the sequence number is greater than th=
e
> spending block's height.
Yes, sorry, I changed it just before sending from "what needs to be
satisfied for the validation error to trigger" to "what needs to be
satisfied for the tx to be valid".
You're right.
> There should be an exception for final inputs. Otherwise, they will coun=
t
> as relative locktime of 0xFFFFFFFF. Is this check handled elsewhere?
>
> if (!tx.vin[i].IsFinal() && nSpendHeight < coins->nHeight +
> tx.vin[i].nSequence)
> return state.Invalid(false, REJECT_INVALID,
> "bad-txns-non-final-input");
Yes, this would be the simplest solution. Another option would be to
have a new tx version in which IsFinal(CTransaction) doesn't check the
inputs sequences to be 0xFFFFFFFF for the tx to be final.
> Is the intention to let the script check the sequence number?
>
> <number> OP_RELATIVELOCKTIMEVERIFY
>
> would check if <number> is less than or equal to the sequence number.
Yes.
> It does make sequence mean something completely different from before.
> Invalidating previously valid transactions has the potential to reduce
> confidence in the currency.
Well, the semantics of nSequence don't really change completely. In
fact, one could argue that this put it closer to its original
semantics.
But in any case, yes, already signed transaction should remain valid.
No transaction would become invalid, just non-final.
As soon as the height of its inputs plus their respective nSquences
get higher than current height they will become final again.
I cannot think of any use case where a tx becomes invalid forever.
Also, probably most people have usedrelatively low values for
nSequence given the original semantics, just like the relative lock
nSquence will likely be used as well.
> A workaround would be to have a way to enable it in the sigScript by
> extending Peter Todd's suggestion in the other email chain.
>
> <1> OP_NOP2 means OP_CHECKLOCKTIMEVERIFY (absolute)
> <2> OP_NOP2 means OP_RELATIVECHECKLOCKTIMEVERIFY
>
> <3> OP_NOP2 means OP_SEQUENCE_AS_RELATIVE_HEIGHT
To be clear, this proposal is supposed to replace RCLTV, so there
would still be 2 options. But please let's imagine we have infinite
opcodes in this thread and let the "should we design an uglier
scripting langues to save opcodes?" question in the other one.
> OP_SEQUENCE_AS_RELATIVE_HEIGHT would cause the script to fail unless it w=
as
> the first opcode in the script. It acts as a flag to enable using the
> sequence number as for relative block height.
>
> This can be achieved using a simple pattern match.
>
> bool CScript::IsSequenceAsRelativeHeight() const
> {
> // Extra-fast test for pay-to-script-hash CScripts:
> return (this->size() >=3D 4 &&
> this->at(0) =3D=3D OP_PUSHDATA1 &&
> this->at(1) =3D=3D 1 &&
> this->at(2) =3D=3D 0xFF &&
> this->at(3) =3D=3D OP_NOP2);
> }
>
> if (!tx.vin[i].IsFinal() && tx.vin[i].scriptSig.IsSequenceAsRelativeHeigh=
t()
> && nSpendHeight < coins->nHeight + tx.vin[i].nSequence)
> return state.Invalid(false, REJECT_INVALID,
> "bad-txns-non-final-input");
This gives you less flexibility and I don't think it's necessary.
Please let's try to avoid this if it's possible.
> On Mon, May 4, 2015 at 12:24 PM, Jorge Tim=C3=B3n <jtimon@jtimon.cc> wrot=
e:
>>
>> for (unsigned int i =3D 0; i < tx.vin.size(); i++) {
>> // ...
>> if (coins->nHeight + tx.vin[i].nSequence < nSpendHeight)
>> return state.Invalid(false, REJECT_INVALID,
>> "bad-txns-non-final-input");
>> // ...
>> }
>
>
>
>
> -------------------------------------------------------------------------=
-----
> One dashboard for servers and applications across Physical-Virtual-Cloud
> Widest out-of-the-box monitoring support with 50+ applications
> Performance metrics, stats and reports that give you Actionable Insights
> Deep dive visibility with transaction tracing using APM Insight.
> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
> _______________________________________________
> Bitcoin-development mailing list
> Bitcoin-development@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/bitcoin-development
>
|