In which file in the bitcoin source code is the signature verification process done? - digital-signature

I'm looking for the transaction signature verification process in the bitcoin source code (from https://github.com/bitcoin/bitcoin) but I can't find it. Where is it done ?

A bitcoin transaction does not have a signature. Instead, it references outputs from previous transactions by supplying an unlocking script for each of the referenced outputs.
For more information about the transaction layout see here
The transaction verification code can be found in tx_check.cpp and tx_verify.cpp here.
The actual script execution code can be found in EvalScript here

Related

Is there a way to read NFT metadata in the anchor program(rust)?

I tried using mint account info (which obviously wouldn't work) and I also tried to deserialise the mint.to_account_info().data into the metadata struct from the mpl_token_metadata::state::Metadata. This gave errors.
I need the sellerFeeBasisPoints and the creators info from the NFT Metadata.
Also, is there a way to update the primarySaleHappened parameter? (I am writing a custom auction contract for an NFT Marketplace).
Thanks in Advance :)
You can deserialize the Metadata-struct by using the mpl_token_metadata-crate provided by Metaplex:
use mpl_token_metadata::state::Metadata;
let metadata: Metadata = Metadata::from_account_info(metadata_account_info)?;
For your second question, please open a new question.
For the second question if you are planning to update the primarySaleHappened from the program then you can do a CPI (Cross Program Invocation) to the Token metadata program to this function update_primary_sale_happened_via_token. Similarly, you can find createUpdatePrimarySaleHappenedViaTokenInstruction in the #metaplex-foundation/mpl-token-metadata npm package to do it in the js/ts side.

Live call transfer by using asterisk

i want to transfer a call from first executive to second executive when customer call to first executive by mistake? How first executive can map customer to second executive by pressing a key by using asterisk technology?
Default transfer is *2. For exact code check features.conf
You also have dialplan Transfer application you can map on any other extension.
You have Transfer ami command usable via asterisk managment interface(AMI)
The question is a bit vague, but since you put freepbx on the tags, I suppose you are using freepbx generated dialplan.
If I understand well, when a certain inbound context calls executive1 you want
1) them to be automagically redirected on executive2 before executive1 answers
or
2) executive1 answers, realizes that call is wrong and blind-transfers call to executive2 pressing a single button (= DTMF).
CASE 1 - Automatic redirection
Edit your /etc/asterisk/extension_custom.conf
[your inbound context]
exten => <executive 1 number>,Goto(your inbound context, executive2 number, 1)
You can find the name of your inbound context in the freepbx automatic generated dialplan, or in the freepbx GUI
CASE2 - In call transfer
Refer to this post to define a new feature code for in-call transfer. Unfortunately your feature code will be likely some #digit
Associate the application
Goto(your inbound context, executive2 number, 1)
to the feature code
Hope this will help.

ScriptError using Google Apps Script Execution API

Following these guides https://developers.google.com/apps-script/guides/rest/quickstart/target-script and https://developers.google.com/apps-script/guides/rest/quickstart/nodejs, I am trying to use the Execution API in node to return some data that are in a Google Spreadsheet.
I have set the script ID to be the Project Key of the Apps Script file. I have also verified that running the function in the Script Editor works successfully.
However, when running the script locally with node, I get this error:
The API returned an error: Error: ScriptError
I have also made sure the script is associated with the project that I use to auth with Google APIs as well.
Does anyone have any suggestion on what I can do to debug/ fix this issue? The error is so generic that I am not sure where to look.
UPDATE: I've included a copy of the code in this JSBin (the year function is the entry point)
https://jsbin.com/zanefitasi/edit?js
UPDATE 2: The error seems to be caused by the inclusion of this line
var spreadsheet = SpreadsheetApp.open(DriveApp.getFileById(docID));
It seems that I didn't request the right scopes. The nodejs example include 'https://www.googleapis.com/auth/drive', but I also needed to include 'https://www.googleapis.com/auth/spreadsheets' in the SCOPES array. It seems like the error message ScriptError is not very informative here.
In order to find what scopes you'd need, to go the Script Editor > File > Project Properties > Scopes. Remember to delete the old credentials ~/.credentials/old-credential.json so that the script will request a new one.
EDIT: With the update in information I took a closer look and saw you are returning a non-basic type. Specifically you are returning a Sheet Object.
The basic types in Apps Script are similar to the basic types in
JavaScript: strings, arrays, objects, numbers and booleans. The
Execution API can only take and return values corresponding to these
basic types -- more complex Apps Script objects (like a Document or
Sheet) cannot be passed by the API.
https://developers.google.com/apps-script/guides/rest/api
In your Account "Class"
this.report = spreadsheet.getSheetByName(data.reportSheet);
old answer:
'data.business_exp' will be null in this context. You need to load the data from somewhere. Every time a script is called a new instance of the script is created. At the end of execution chain it will be destroyed. Any data stored as global objects will be lost. You need to save that data to a permanent location such as the script/user properties, and reloaded on each script execution.
https://developers.google.com/apps-script/reference/properties/

Determine if a cucumber scenario has pending steps

I would like to retrieve the scenario state in the "After" scenario hook. I noticed that the .failed? method does not consider pending steps as failed steps.
So How can I determine that a scenario did not execute completely, because it failed OR because some steps were not implemented/defined.
You can use status method. The default value of status is :skipped, the failed one is :failed and the passed step is :passed. So you can write something like this:
do sth if step.status != :passed
Also, if you use !step.passed? it does the same thing because it only checks for the :passed status.
http://cukes.info/api/cucumber/ruby/yardoc/Cucumber/Ast/Scenario.html#failed%3F-instance_method
On that subject, you can also take a look at this post about demoing your feature specs to your customers: http://multifaceted.io/2013/demo-feature-tests/
LiohAu, you can use the 'status' method on a scenario itself rather than on individual steps. Try this: In hooks, add
After do |scenario|
p scenario.status
end
This will give the statuses as follows:
Any step not implemented / defined, it'll give you :undefined
Scenario fails (when all steps are defined) :failed
Scenario passes :passed
Using the same hook, it'll give you the status for scenario outline, but for each example row (since for each example row, it is an individual scenario). So if at all you want the result of an entire outline, you'll need to capture result for all example rows and compute the final result accordingly.
Hope this helps.

BPEL process stopped on a second receive

I am new in BPEL writing. I have realized the simple process below:
receive1
|
|
invoke1
|
|
receive2
|
|
invoke2
The problem is that the process correctly runs till to the "receive2" but when I invoke, via soapUI, the operation associated to the "receive2" nothing happens. I have read other posts about BPEL but nothing matching with this question. Below the real activities (I omitted the Assign ones) involved.
<bpel:receive name="receiveInput" partnerLink="client"
portType="tns:HealthMobility"
operation="initiate" variable="input"
createInstance="yes"/>
<bpel:invoke name="getTreatmentOptions"
partnerLink="treatmentProviderPL" operation="getTreatmentOptions"
inputVariable="getTreatmentOptionsReq" outputVariable="getTreatmentOptionsResp">
</bpel:invoke>
<bpel:receive name="bookMobility" partnerLink="client" operation="bookMobility"
variable="bookMobilityReq" portType="tns:HealthMobility"/>
<bpel:invoke name="getTripOptions" partnerLink="mobilityMultiProvidersPL"
operation="getTripOptions" inputVariable="getTripOptionsReq"
outputVariable="getTripOptionsResp"></bpel:invoke>
I have tried to make debugging simply by deleting the receive and initializing statically the input variable required by the getTriOptions invoke. In this case all works fine so it means, necessarly, that the process continue to wait on the receive also if I invoke bookMobility via SOAPUI. My question is: Why? I'm missing something?
Thanks
You need to define a correlation set for the second receive. Each message that is sent to the operation that is connected to the first receive activity will create a new process instance. This means you may have multiple instance running in parallel. When these instances have reached the second receive, they are waiting for the second message, but in your example, there are no means to distinguish, which message is targeted to which process instance. I assume that your BPEL engine also logged that it could not route the message to a target instance.
To solve this problem, you need to find an identifier in the payload of a message and initialize a correlation set with this value. Then, when using the same correlation set with the second receive, all messages that contain the same identifier will be routed to this particular process instance. For further information about correlation sets I recommend reading the BPEL primer, section 4.2.4.

Resources