BitcoinJ walletTemplate P2WPKH Send payment not working - java

I have tried to use WalletTemplate sub-project inside bitcoinJ lib. I have tried p2pkh sends and they work fine. But then I tried to make P2WPKH payment but it failed with the following error message
org.bitcoinj.core.RejectedTransactionException: Reject: tx
539c7f25b14b20dfad1ad66923fa59bf7531cd1ebda967e8346793fa2464f5dc for
reason 'non-mandatory-script-verify-flag (Signature must be zero for
failed CHECK(MULTI)SIG operation)' (64)
This behavior doesn't exist before commit. So I'm not sure how to handle the changes introduced since this change.
I have also create github issue to get more information but I haven't got any response yet. I have tried code outside of bitcoinj's walletTemplate in another project as follows:
NetworkParameters params = TestNet3Params.get();
Address destination = Address.fromString(params, strDest);
Coin value = Coin.parseCoin(strValue);
SendRequest request = SendRequest.to(destination, value);
SendResult result = wallet.sendCoins(request);
Any help would be appreciated. Thanks

Issue was solve on github via the latest commit 7c31dcb.

Related

How to fix AWS 403 error "Check your AWS Secret Access Key and signing method" when calling SES listcontacts

I have been stuck for about the past 6 hours at this point I'm thinking the only reasonable explanations are that this is a AWS SDK bug or the error message is wrong.
I am using SESv2 class from the AWS SDK in a JAVA SpringBoot app and attempting to manage various details of my SES (Simple Email Service) account.
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.sesv2.SesV2Client;
import software.amazon.awssdk.services.sesv2.model.*;
I have created an IAM user, created security credentials, set them up using multiple different methods as described here guid to credentials environment I've given full access to SES to this IAM role user. I then wrote some code and I was able to do all of the following,
Create a contact list
Delete a contact list
Create contact
Create a Topic in a contact list
Send an email
However, for some unknown reason when I go to test a function I wrote to get a list of contacts so I can test sending an email to multiple contacts I get the following 403 error message,
The request signature we calculated does not match the signature you
provided. Check your AWS Secret Access Key and signing method. Consult
the service documentation for details.
I've verified the credentials are correct. I have created a new set of credentials and made the old set inactive. No dice, all the functions listed above still work however the listContacts in the SesV2Client class still fails with the same error. As you can see below I even bypassed the env variables and just hardcoded the key and secret to pull out all the stops, still fails. In the function that fails, I've gone over and over the values im passing in they are valid and exist 100% because as I said I can make the other calls in the list above to verify the topics and contact list exists.
private List<Contact> listContactsForSiteUpdatesMailingList() {
try (SesV2Client client = SesV2Client.builder()
.region(Region.US_EAST_1)
.credentialsProvider(StaticCredentialsProvider.create(awsCreds))
.build()){
TopicFilter topicFilter = TopicFilter.builder().topicName(TOPIC_SITE_UPDATES).useDefaultIfPreferenceUnavailable(true).build();
ListContactsFilter listContactsFilter = ListContactsFilter.builder().topicFilter(topicFilter).filteredStatus(SubscriptionStatus.OPT_IN).build();
ListContactsRequest listContactsRequest = ListContactsRequest.builder()
.contactListName(CONTACT_LIST).filter(listContactsFilter).build();
ListContactsResponse listContactsResponse = client.listContacts(listContactsRequest);
return listContactsResponse.contacts();
} catch (Exception ex) {
System.out.println("The email was not sent. Error message: "
+ ex.getMessage());
return null;
}
}
Whats going on here and how can I get to the bottom of this error?
EDIT:
Looking at AWS Console Users>Access Management and then looking at the user a created I can even verify that there was "programmatic access"
An example of accessing a ContactList with no issues
EDIT 2: My SES account is currently sandboxed. I just wanted to mention the question is this possibly happening because of that? Grasping at straws here.
I was able to reproduce your issue. I created a list and added a contact. Both worked. However, when i executed listContacts, I got this error:
This looks like a bug. To address this, open a Github issue on the SDK Java Github here:
https://github.com/aws/aws-sdk-java
This is confirmed as a bug in the AWS SDK. To get around this you can use the async client like so
SesV2AsyncClient client = SesV2AsyncClient.builder()
.region(Region.US_EAST_1)
.build())
TopicFilter topicFilter = TopicFilter.builder().topicName(TOPIC_SITE_UPDATES).useDefaultIfPreferenceUnavailable(true).build();
ListContactsFilter listContactsFilter = ListContactsFilter.builder().topicFilter(topicFilter).filteredStatus(SubscriptionStatus.OPT_IN).build();
ListContactsRequest listContactsRequest = ListContactsRequest.builder()
.contactListName(CONTACT_LIST).filter(listContactsFilter).build();
CompletableFuture<ListContactsResponse> listContactsResponseCompletableFuture = client.listContacts(listContactsRequest);
ListContactsResponse listContactsResponse = listContactsResponseCompletableFuture.get();

Java ClearCase Update on a HTTPS Server

I am trying to automate ClearCase, so I can do automatic building. The first step is to update a view by script. I am trying this with the following Java code:
StpProvider provider = (StpProvider) ProviderFactory.createProvider(
CcProvider.NETWORK_PROVIDER_CLASS, callback);
provider.setServerUrl("https://...");
CcProvider m_provider = provider.ccProvider();
m_provider.registerTrustManagerCallback(callback);
File viewRoot = new File("D:\\Views\\...");
StpLocation viewLocation = provider.filePathLocation(StpProvider.Domain.CLEAR_CASE, viewRoot);
//Get instance of CcView that represents the CCRC view.
CcView view = m_provider.ccView(viewLocation);
//Options while updating view
CcFile.RefreshFlag[] refreshFlags = new CcFile.RefreshFlag[1];
refreshFlags[0] = CcFile.RefreshFlag.KEEP_HIJACKS;
PropertyRequestItem.PropertyRequest properties = new PropertyRequestItem.PropertyRequest(CcView.DISPLAY_NAME, CcView.CONFIG_SPEC);
view.doRefresh(refreshFlags, properties);
MyCallback is just a simple Implementation of Callback and CcTrustManagerCallback, with no extra logic to it. I get the following error:
Exception in thread "main" CcException: CRMAP7009: Der Befehl "Update" ist fehlgeschlagen:
CCRC WAN Server: Error: Unable to get view handle.
Fehler: "java.io.IOException: Status(1001:hasNonOkMsg):
CCRC WAN Server: Error: Unable to get view handle.
"
reason: conflict
resource: view: cc.file:D:/Views/...
at com.ibm.rational.stp.client.internal.cc.Util.ccrcCmdStatusToWvcmException(Util.java:296)
at com.ibm.rational.stp.client.internal.cc.Util.runCommandAndCheckResults(Util.java:160)
at com.ibm.rational.stp.client.internal.cc.WebViewRefresh.run(WebViewRefresh.java:233)
at com.ibm.rational.stp.client.internal.cc.CcFileImpl.doCcRefresh(CcFileImpl.java:392)
at com.ibm.rational.stp.client.internal.cc.CcFileImpl.doRefresh(CcFileImpl.java:381)
at cc.UpdateView.main(UpdateView.java:45)
Does anyone know how to resolve this conflict ? ClearTeam Explorer is working, I am manually updating via the Eclipse plugin. ClearCase Version 9.0.1.4 and ClearTeam Explorer Version Version: 9.0.1.08. Using Java 8.
Finally solved the problem, thank you #Abra for your responses. But the problem was only that I had to set the PRIMARY_GROUP to the correct group.
If you have an error like this, first check out if CC operations with ClearTeamExplorer or normal ClearCase work and then check out how it is configured and make sure to have the same settings for the CLI.

How to verify that a queue exist on azure in java?

We have a service that receive the queue name and if the queue exist push data on the queue.
I'm looking to find a way to check if the queue exist on azure in java.
So far, using IQueueClient I can onl know if the queue exist when sending data via sendAsync with return a exception.
I want to found out when the client is created or even before.
The best answer I've found so far is using the NamespaceManager.
in this fashion:
Uri uri = ServiceManagementHelper.GetServiceUri();
TokenProvider tokenProvider = ServiceManagementHelper.GetTokenProvider(uri);
NamespaceManager nm = new NamespaceManager(uri, tokenProvider);
if (!nm.QueueExists("TestQueue")) return;
source:
http://www.cloudcasts.net/devguide/Default.aspx?id=12018
https://www.pmichaels.net/2017/06/11/reading-message-azure-service-bus-queue/
However this class seem not to be part of azure-core or azure-servicebus librairy and I can seem to find which lib to add to the project to have access to those class.
However this class seem not to be part of azure-core or azure-servicebus librairy and I can seem to find which lib to add to the project to have access to those class.
You mentioned code is related to .net SDK. For Java sdk we could use the following code check if the queue exist. ManagementClient seems only available in the 2.0.0-PREVIEW version. We also could get the source code from GitHub.
String connectionString = "Endpoint=sb://xxxx.servicebus.windows.net/;SharedAccessKeyName=SharedAccessKeyName;SharedAccessKey=xxxxxxxx=";
ConnectionStringBuilder connectionStringBuilder = new ConnectionStringBuilder(connectionString);
ManagementClient client = new ManagementClient(connectionStringBuilder);
boolean isExist = client.queueExists("queueName");
System.out.println(isExist);
Test Result:

GcsServiceImpl.createOrReplace Not working?

Summary
This happened since May 20th's night (Pacific Time). Initially, I thought it was Google Cloud Storage failure. It seems now that they supported my way of storing data before. But somehow, after May 20th, that API does not work the same way as before.
How did I call
GcsFileOptions fileOptions = new GcsFileOptions.Builder().mimeType("image/png").acl("public-read").build();
GcsFilename filename = new GcsFilename(fileBucket, objectName); // fileBucket="test", objectName="/code/my/yeuei"
GcsService service = GcsServiceFactory.createGcsService();
GcsOutputChannel oc = service.createOrReplace(filename,fileOptions); //error happens here.
Error
Google Cloud Storage API gives error when the object is not existing.
GcsServiceImpl.createOrReplace method
I am creating a new object.
E 10:03:00.643 com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
com.google.appengine.tools.cloudstorage.NonRetriableException: java.lang.NullPointerException
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:120)
at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:166)
at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:156)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl.createOrReplace(GcsServiceImpl.java:68)
This line seems causing the error -
Caused by: java.lang.NullPointerException
at com.google.appengine.tools.cloudstorage.oauth.URLFetchUtils$HTTPRequestInfo.<init>(URLFetchUtils.java:80)
at com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsService.beginObjectCreation(OauthRawGcsService.java:184)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:71)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:68)
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:108)
Nothing on the status page. You might wish to check it in the future.
Ok. This is resolved. I am still not sure how it is introduced in the first place.
Here is what happens -
There is a class URLFetchUtils in App Engine GCS Client library, when it initiates, it did not check if payload is null, that creates the NullPointer exception. Today, GCS Java Client Library has an update fixed this issue, so if you use the latest version (app engine GCS 0.3.12), this error will go away. Interestingly, I have no idea how it worked before :) ... But anyway, I am glad that my app is working again - after about 24 hours down.

Unexpected error when publishing photo to page

I'm trying to publish a photo to a page using the following:
FacebookClient client = new DefaultFacebookClient(destinationAccessToken);
BinaryAttachment attachment = BinaryAttachment.with(imageName, imageInputStream);
Photo photoResponse = client.publish("/me/photos", Photo.class, attachment);
I'm getting the following response:
{
"error": {
"message":"An unexpected error has occurred. Please retry your request later.",
"type":"OAuthException",
"code":2
}
}
When I use the same code to publish to a user wall it works fine.
I've also tried posting to "/{page id}/photos" with the same result.
The destination access token has the manage_pages, photo_upload, publish_actions, and publish_stream permissions amongst others.
What am I doing wrong here?
UPDATE:
If I publish to a predetermined album using "/{album id}/photos" then it works. Quoting this Facebook developer blog post:
https://graph.facebook.com/USER_ID/photos - The photo will be
published to an album created for your app. We automatically create an
album for your app if it does not already exist. All photos uploaded
this way will then be added to this same album.
So is this behavior broken for pages? Or am I misunderstanding something here?
UPDATE 2:
I found a bug report for this issue, so I'm posting that as an answer.
UPDATE 3:
The bug seems to have been resolved.
I found the Facebook bug report corresponding to this behavior:
http://developers.facebook.com/bugs/355536551171535
So it would seem I'm not doing anything wrong. I guess the temporary workaround would be to check for a predetermined album and create it if necessary, then publish to it. (Note that the user_photos permission is not needed for this workaround, since albums/photos on pages are always public).

Categories

Resources